#include<stdio.h>
#include<string.h>
#define PF printf
#define SF scanf
int main()
{
int n, i, j, count = 1, max = 0;
char color[1000][16], temp[16];
while((~SF("%d",&n)) && (n != 0))
{
for(i=0;i<n;i++)
SF("%s",color[i]);
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
if(strcmp(color[i],color[j]) == 0)
count++;
if(count > max)
{
max = count;
strcpy(temp, color[i]);
}
count = 1;
}
PF("%s\n",temp);
memset(color[0],0,sizeof(color[0]));
memset(temp, 0, sizeof(temp));
max = 0;
}
return 0;
}
考察了字符串的简单应用吧,记录一下