#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

bool isBrother(string str, string input){
    int strArr[26]={0};
    int inputArr[26]={0};

    for(int i=0;i<str.size();i++)
        strArr[(int)str[i]-97]++;

    for(int i=0;i<str.size();i++)
        inputArr[(int)input[i]-97]++;

    for(int i=0;i<26;i++)
        if(strArr[i]!=inputArr[i])
            return false;

    return true;

}


int main(){
    string str;
    int N,k;

    while(cin>>N){

        vector<string> sV,res;
        while(N--){
            cin>>str;
            sV.push_back(str);
        }

        cin>>str>>k;

        int i=0;
        loop:
        while(i<sV.size()){
            if(sV[i]==str || sV[i].size()!=str.size()){
                i++;
                goto loop;
            }

            if(!isBrother(str, sV[i])){
                i++;
                goto loop;
            }

            res.push_back(sV[i]);
            i++;
        }

        sort(res.begin(),res.end());

        cout<<res.size()<<endl;
        if(res.size()>=k)
            cout<<res[k-1]<<endl;
    }

    return 0;
}