#include <bits/stdc++.h>
using namespace std;
//20.54
bool isbro(string s1, string s2) {
    /*兄弟单词:首先长度要一样,其次每个字母出现的频数要一样*/
    if (s1 == s2) return false;
    if (s1.length() != s2.length()) return false;
    vector<char> v(26, 0);
    for (int i = 0; i < s1.length(); i++) {
        v[s1[i] - 'a']++;
        v[s2[i] - 'a']--;
    }
    for (int i = 0; i < 26; i++) {
        if (v[i] != 0) return false;
    }
    return true;
}
int main() {
    int n;
    string s;
    int k;
    while (cin >> n) {
        vector<string> v;
        vector<string> bro;
        while (n--) {
            cin >> s;
            v.push_back(s);
        }
        cin >> s; //然后输入一个单词x
        cin >> k;
        int pos = -1;
        //检查是不是兄弟单词
        for (int i = 0; i < v.size(); i++) {
            if (isbro(v[i], s)) {
                bro.push_back(v[i]);
            }
        }
        sort(bro.begin(), bro.end());
        cout << bro.size() << endl;
        if (k <= bro.size()) {
            cout << bro[k - 1];
        }
    }
}
// 64 位输出请用 printf("%lld")