import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Scanner;

public class Main {

public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()) {
        int n = sc.nextInt();
        String[] strings = new String[n];
        for (int i = 0; i < n; i++) {
            strings[i] = sc.next();
        }
        String target = sc.next();
        int k = sc.nextInt();
        char[] targetChars = target.toCharArray();
        Arrays.sort(targetChars);
        String sortTarget = new String(targetChars);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            String str = strings[i];
            if (target.length() == str.length() && !target.equals(str)) {
                char[] strChars = str.toCharArray();
                Arrays.sort(strChars);
                if (new String(strChars).equals(sortTarget)) {
                    list.add(strings[i]);
                }
            }
        }
        Collections.sort(list);
        System.out.println(list.size());
        if (list.size() >= k) {
            System.out.println(list.get(k - 1));
        }
        
    }
}

}