杭电1004

来源:互联网 发布:metasequoia mac 注册 编辑:程序博客网 时间:2024/05/16 04:37
#include <stdio.h>
#include <string.h>


int main(int argc, char *argv[])
{
int i = 0, j = 0;
int n = 0, max = 0, cmp = 0;
char strings[1000][15], strEnd[15];





while(EOF != scanf("%d", &n))
{
if (0 == n)
{
break;
}
for(i = 0; i < n; i++)
{
scanf("%s", strings[i]);
}

for(i = 0 , cmp = 0; i < n; i++)
{

for(j = i, max = 0; j < n; j++)
{
if(0 == strcmp(strings[i], strings[j]))
{
max ++;
}
}


if(cmp < max)
{
strcpy(strEnd, strings[i]);
cmp = max;
}
}


printf("%s\n",strEnd);
}





return 0;
}
0 0