/*
 * 解题思路:不会,暴力解决...
 * 这题目描述真不是给人看的...
 * 我写出来的答案也不是给人看的,反正我明天估计就看不懂了
 */
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            int count = sc.nextInt();
            String[] strs = sc.nextLine().split(" ");
            int len = strs.length - 2;
            int num = Integer.parseInt(strs[len + 1]);
            String toFind = strs[len];

            char[] tmp = toFind.toCharArray();
            Arrays.sort(tmp);
            String target = new String(tmp);
            ArrayList<String> list = new ArrayList<String>();
            for (int i = 0; i < len; i++) {
                if (strs[i].length() == toFind.length() && !strs[i].equals(toFind)) {
                    char[] chs = strs[i].toCharArray();
                    Arrays.sort(chs);
                    if ((new String(chs)).equals(target)) {
                        list.add(strs[i]);  
                    }
                }
            }
            Collections.sort(list);

            System.out.println(list.size());
            if (num < list.size()) {
                // 第k个,不是下标为k
                System.out.println(list.get(num - 1));
            }
        }
    }
}