#include <iostream>
#include <algorithm>
#include <vector>
#include<bitset>
using namespace std;
bool isbrother(string w1,string w2){
int l1=w1.size();
int l2=w2.size();
if(w1==w2) return false;
sort(w1.begin(),w1.end());
sort(w2.begin(),w2.end());
if(w1==w2){
return true;
}else
return false;
}
int main() {
int n;
while(cin>>n){
string mm;
vector<string> vec;
for(int i=0;i<n;i++){
cin>>mm;
vec.push_back(mm);
}
string fir;
cin>>fir;
// cout<<vec.size()<<endl;
int k;
cin>>k;
vector<string> bro;
for(int i=0;i<vec.size();i++){
if(isbrother(fir, vec[i])){
bro.push_back(vec[i]);
}
}
sort(bro.begin(),bro.end());
cout<<bro.size()<<endl;
if(bro.size()>=k)cout<<bro[k-1]<<endl;
}
}
// 64 位输出请用 printf("%lld")