
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool isBrotherSrt(string str, string str2){
sort(str.begin(), str.end());
sort(str2.begin(), str2.end());
return str == str2;
}
void getResult(const string &str, vector<string> &vec) {
vector<string> temp;
for (int i = 0; i < vec.size(); ++i) {
if(str.size() > vec[i].size() || str.size() < vec[i].size()){
continue;
}
else if(str == vec[i]){
continue;
}
else if(isBrotherSrt(str, vec[i])){
temp.push_back(vec[i]);
}
}
sort(temp.begin(), temp.end());
vec = temp;
}
int main() {
int num;
cin >> num;
vector<string> vec;
while (num--) {
string str;
cin >> str;
vec.push_back(str);
}
string totalStr;
cin >> totalStr;
int seqNum;
cin >> seqNum;
getResult(totalStr, vec);
cout << vec.size() << endl;
if(seqNum <= vec.size()){
cout << vec[seqNum - 1] << endl;
}
}