import java.util.*;
/**
* HJ27 查找兄弟单词
*/
public class HJ027 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String[] ss = sc.nextLine().split(" ");
Integer a = Integer.parseInt(ss[0]);
String x = ss[ss.length - 2];
Integer k = Integer.parseInt(ss[ss.length - 1]);
List<String> list = new ArrayList<>();
for (int i = 1; i <= a; i++) {
if (isBrother(x, ss[i])) {
list.add(ss[i]);
}
}
int size = list.size();
System.out.println(size);
if (size >= k) {
Collections.sort(list);
System.out.println(list.get(k - 1));
}
}
sc.close();
}
private static boolean isBrother(String x, String y) {
if (x.length() != y.length() || y.equals(x)) {
return false;
}
char[] s = x.toCharArray();
char[] j = y.toCharArray();
Arrays.sort(s);
Arrays.sort(j);
return new String(s).equals(new String(j));
}
}