#include <vector> #include <iostream> #include <algorithm> using namespace std; int n; vector<string> strs; vector<string> bros; bool isBrothers(string a, string b) { if (a == b) return false; else { if (a.length() != b.length()) return false; else { sort(a.begin(), a.end()); sort(b.begin(), b.end()); return a == b; } } } int main() { cin >> n; for (int i = 0 ; i < n; i++) { string tmp; cin >> tmp; strs.push_back(tmp); } int k; string x; cin >> x >> k; for (auto it = strs.begin(); it != strs.end(); it++) { if (isBrothers(*it, x)) bros.push_back(*it); } sort(bros.begin(), bros.end()); cout << bros.size() << endl; if (k <= bros.size()) { cout << bros[k - 1]; } return 0; }