#include<stdio.h>
#include<string.h>
int main()
{
char str[1000][16];
int n;
while(scanf("%d",&n),n!=0){
char temp[16];int i,j;int count[1000];int pos=0;
memset(count,0,sizeof(count));
for(i=0;i<n;i++){
scanf("%s",temp);
for(j=0;j<pos;j++)
if(strcmp(temp,str[j])==0){
break;
}
if(j<pos)
count[j]++;
else{
count[pos]++;
strcpy(str[pos++],temp);
}
}
int max=0;int mi=0;
for(i=0;i<pos;i++)
if(max<count[i])
{
max=count[i];
mi=i;
}
printf("%s\n",str[mi]);
}
return 0;
}
hdu 1004
最新推荐文章于 2021-06-24 22:53:24 发布