#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

bool isBrother(string a, string b) {
    if (a != b) {
        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        return a == b;
    } else {
        return false;
    }
}

int main() {
    int n, k;
    string x;
    vector<string> strs;
    multiset<string> Set;

    cin >> n;
    while (n--) { 
        string str;
        cin >> str;
        strs.push_back(str);
    }

    cin >> x;
    cin >> k;

    for (string s : strs)
        if (isBrother(s, x))
            Set.insert(s);

    cout << Set.size() << endl;
    if (k >= 1 && k <= Set.size()) {
        set<string>::iterator iter = Set.begin();
        while (--k)
            iter++;
        cout << *iter << endl;
    }
}