#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool isbro(string s1, string s2)
{
    if(s1.length() != s2.length())
        return false;
    if(s1 == s2)
        return false;
    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());
    if(s1 == s2)
        return true;
    return false;
} 
int main()
{
    int n,k;
    string str;
    while(cin >> n)
    {
        vector<string> strs(n);
        for(int i = 0; i < n; i++)
            cin >> strs[i];
        cin >> str >> k;
        vector<string> bros;
        for(int i = 0; i < n; i++)
            if(isbro(str, strs[i]))
                bros.push_back(strs[i]);
        sort(bros.begin(), bros.end());
        cout << bros.size() <<endl;
        if(k<=bros.size())
            cout<< bros[k - 1] << endl;
    }
}