Let the Balloon Rise Wrong Answer
发布网友
发布时间:2024-10-11 06:48
我来回答
共1个回答
热心网友
时间:2024-11-14 02:36
#include<stdio.h>
#include<string.h>
int main()
{
int i,n,j,max,k;
char a[1000][16];
int count[1000] = {0};
max = 0;
while(scanf("%d", &n) != EOF && n != 0)
{
i = 0;
scanf("%s", &a[i]);
count[i] = 0;
for(i = 1; i < n; i++)
{
scanf("%s",&a[i]);
count[i] = 0;
for(j = 0;j < i;j++)
{
if(strcmp(a[i],a[j]) == 0)
{
count[j]++;
}
}
}
max = -1;
for(i = 0; i < n; i++)
{
if(count[i] > max)
{
max = count[i];
k = i;
}
}
printf("%s\n",a[k]);
}
return 0 ;
}