原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=1004
#include <iostream>
#include <cstdio>
using namespace std;
int N,ans,sum;
struct colors{
int no;
int x;
string c;
};
colors color[1005];
int main()
{
while(scanf("%d",&N) && N!=0)
{
sum = 0;
ans = 0;
for(int i=1;i<=N;i++)
{
cin >> color[i].c;
color[i].x = 0;
color[i].no = i;
for(int j=1;j<=i;j++)
{
if(color[j].c == color[i].c)
{
++color[j].x;
if(color[j].x > sum)
{
sum = color[j].x;
ans = color[j].no;
}
}
}
}
cout << color[ans].c << endl;
}
return 0;
}