import java.util.*;
// 题意太难懂了,做了好久,思路错了好多次
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextLine()) {
String s = in.nextLine();
String[] split = s.split(" ");
int n = Integer.parseInt(split[0]);
String[] dict = new String[n];
for (int i = 0; i < n; i++) {
dict[i] = split[i + 1];
}
String t = split[n + 1];
int k = Integer.parseInt(split[n + 2]);
String[] out = find(dict, t, k);
if (null == out[1]) {
System.out.println(out[0]);
} else {
System.out.println(out[0]);
System.out.println(out[1]);
}
}
}
public static String[] find(String[] dict, String t, int k) {
int n = dict.length;
String[] res = new String[2];
int[] dict1 = new int[26];
for (int i = 0; i < t.length(); i++) {
dict1[t.charAt(i) - 'a']++;
}
List<String> list = new ArrayList<>();
for (int i = 0; i < n; i++) {
if (!dict[i].equals(t) && t.length() == dict[i].length() && isBrother(dict1, dict[i])) {
list.add(dict[i]);
}
}
res[0] = list.size() + "";
if (k > list.size()) {
return res;
}
Collections.sort(list, (a, b) -> a.compareTo(b));
res[1] = list.get(k - 1);
return res;
}
public static boolean isBrother(int[] dict1, String b) {
int[] dict2 = new int[26];
for (int i = 0; i < b.length(); i++) {
dict2[b.charAt(i) - 'a']++;
}
return Arrays.equals(dict1, dict2);
}
}