题目描述
不会
样例
#include <iostream>
using namespace std;
int main()
{
string s[200];
int n;
while (cin >> n, n)
{
int len = 300;
for (int i = 0; i < n; i ++ )
{
cin >> s[i];
if (s[i].size() < len) len = s[i].size();
}
while (len)
{
bool is_hz = true;
for (int i = 1; i < n; i ++ )
{
bool is_same = true;
for (int j = 1; j <= len; j ++ )
{
if (s[0][s[0].size() - j] != s[i][s[i].size() - j])
{
is_same = false;
break;
}
}
if (!is_same)
{
is_hz = false;
break;
}
}
if (is_hz) break;
len -- ;
}
cout << s[0].substr(s[0].size() - len) << endl;
}
return 0;
}