#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> ss;
while (n) {
string t;
cin >> t;
ss.push_back(t) ;
n--;
}
string target;
cin >> target;
int k;
cin >> k;
unordered_map<char, int> thm;
for (auto c : target) {
thm[c]++;
}
int len = target.length();
vector<string> res;
for (auto i : ss) {
unordered_map<char, int> hm = thm;
int tlen = 0;
for (auto c : i) {
if (hm.find(c) != hm.end() && hm[c] > 0) {
tlen++;
hm[c]--;
} else {
break;
}
}
if (tlen == len &&i.length()==target.length() && i!=target) {
res.push_back(i);
}
}
sort(res.begin(), res.end());
cout << res.size() << endl;
if(k<res.size())cout << res[k - 1];
// for(auto s: res)cout<<s<<endl;
}
// 64 位输出请用 printf("%lld")