#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int compare(const void *a, const void *b) {
return strcmp((char *)a, (char *)b);
}
int main() {
int n;
scanf("%d", &n);
char str[n][11];
for(int i = 0; i < n; i++) {
scanf("%s", str[i]);
}
char x[11];
int k;
scanf("%s %d", x, &k);
// printf("k's value is %d\n", k);
int countX[26] = {0};
int lenX = strlen(x);
char brothers[n][11];
// char newstr[n][11];
int m = 0;
// int newstrIndex = 0;
// 重新排列str,去重储存到newstr中
qsort(str, n, sizeof(str[0]), compare);
// strcpy(newstr[newstrIndex++], str[0]);
// for(int i = 1; i < n; i++) {
// if(!(strcmp(str[i],str[i-1]) == 0)) {
// strcpy(newstr[newstrIndex++], str[i]);
// printf("%s\n", newstr[newstrIndex-2]);
// }
// }
// printf("x is %s\n", x);
// 遍历x,统计字母数量
for(int i = 0; i < lenX; i++) {
if(islower(x[i])) {
countX[x[i] - 'a']++;
// printf("countX plus one\n");
} else if(isupper(x[i])) {
countX[x[i] - 'A']++;
}
}
// 遍历newstr
for(int i = 0; i < n; i++) {
int countY[26] = {0};
int lenY = strlen(str[i]);
for(int j = 0; j < lenY; j++) {
if(islower(str[i][j])) {
countY[str[i][j] - 'a']++;
} else if(isupper(str[i][j])) {
countY[str[i][j] - 'A']++;
}
}
int valid = 1;
for(int j = 0; j < 26; j++) {
if(countX[j] != countY[j]) {
valid = 0;
break;
}
}
if(valid) {
if(!(strcmp(str[i], x) == 0))
strcpy(brothers[m++], str[i]);
}
}
printf("%d\n", m);
// for(int i = 0; i < m; i++) {
// printf("%s\n", brothers[i]);
// }
if(m > 0) printf("%s\n", brothers[k - 1]);
}