#include <algorithm> #include <iostream> #include <set> #include <vector> using namespace std; // 通过排序算法判断是否是兄弟单词。 bool isBro(string& s1, string& s2){ if(s1 == s2){ return false; } if(s1.length() != s2.length()){ return false; } string t1,t2; t1 = s1; t2 = s2; sort(t1.begin(), t1.end()); sort(t2.begin(), t2.end()); return t1==t2; } int main() { int n; cin >> n; string str; vector<string> v; for(int i = 0; i < n; i++){ cin >> str; v.push_back(str); } cin >> str; cin >> n; vector<string> s; for(auto it : v){ if(!isBro(it, str)){ continue; } s.push_back(it); } sort(s.begin(), s.end()); cout << s.size() << endl; if(s.size()>0){ cout << s[n-1] << endl; } return 0; } // 64 位输出请用 printf("%lld")