#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool isBrother(string a, string b)
{
if (a.length() != b.length() || a == b) {
return false;
}
for (auto ch: a) {
int idx = b.find(ch);
if (-1 == idx) {
return false;
}
b.erase(idx, 1);
}
return true;
}
int main() {
int n, idx;
cin >> n;
vector<string> strVec;
string tmp, x;
for (int i=0; i<n; i++) {
cin >> tmp;
strVec.push_back(tmp);
}
cin >> x;
cin >> idx;
vector<string>::iterator iter = strVec.begin();
while (iter != strVec.end()) {
if (!isBrother(*iter, x)) {
strVec.erase(iter);
} else {
++ iter;
}
}
cout << strVec.size() << endl;
if (strVec.size() > 0) {
sort(strVec.begin(), strVec.end());
cout << strVec[idx-1];
}
}
// 64 位输出请用 printf("%lld")