#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
int n;
vector<string> s(n);
cin>>n;
getchar();
for(int i = 0; i < n; i++)
getline(cin, s[i]);
string result = "";
for(int i = 1; true; i++){
for(int j = 0; j < n; j++){
if(i > s[j].length() || s[j][s[j].length() - i] != s[0][s[0].length() - i]){
cout<<((result == "") ? "nai" : result)<<endl;
return 0;
}
}
result = s[0][s[0].length() - i] + result;
}
}
用LUA(和C++)刷PAT (Advanced Level) ——1077 Kuchiguse
最新推荐文章于 2024-11-14 16:58:13 发布