#include<cstdio>
#include<cstring>
int main(){
int n,count = 0,minLen = 256;
scanf("%d",&n);
char str[n][257];
getchar(); //注意吸收回车
for(int i = 0;i < n;i++){
gets(str[i]); //linux下已经无法使用gets
int len = strlen(str[i]);
if(minLen>len) minLen = len;
for(int j = 0;j < len/2;j++){
char temp = str[i][j];
str[i][j] = str[i][len-j-1];
str[i][len-j-1] = temp;
}
}
for(int i = 0;i < minLen;i++){
bool flag = true;
char std = str[0][i];
for(int j = 1;j < n;j++){
if(str[j][i]!=std){ //注意i,j顺序
flag = false;
break;
}
}
if(!flag) break;
count++;
}
if(!count) printf("nai\n");
else{
while(count) printf("%c",str[0][--count]);
}
return 0;
}
A1077 Kuchiguse (20)
最新推荐文章于 2020-03-06 11:11:18 发布