#include <iostream>
#include <string>
#include <map>
using namespace std;
int main()
{
map<string,int>m;
string s;
map<string,int>::iterator it,it2;
int n;
while(cin>>n&&n)
{
m.clear();
for(int i=0;i<n;i++)
{
cin>>s;
//在映照容器中查找键值
if(m.find(s)!=m.end()) m[s]++;
else m[s]=1;
}
it2=m.begin();
for(it=m.begin();it!=m.end();it++)
{
//注意,映照容器中,元素的键值为it->first
//元素映照值为it->second
if(it2->second<it->second)
it2=it;
}
cout<<it2->first<<endl;
}
return 0;
}
ZOJ 2104/HDU 1004 Let the Balloon Rise(map容器)

