思路:使用map<string,int> mp
字符串的hash

#include<iostream>
#include<cstdio>
#include<map>
#include<cstring>
#include<algorithm>
#include<string>
using namespace std;
int main(){
	map<string,int> mp;
	int n;
	char s[20];
	string str;
	map<string,int>::iterator it,it2;
	while(scanf("%d",&n)!=EOF&&n!=0){
		mp.clear();
		for(int i=0;i<n;i++){
			scanf("%s",s);
			str=s;
			if(mp.find(str)!=mp.end())
					mp[str]+=1;
			else
					mp[str]=1;	
		}
		it2=mp.begin();
		for(it=mp.begin();it!=mp.end();it++){
			if(it->second > it2->second)
					it2=it;
		}
		printf("%s\n",it2->first.c_str());
	}
	return 0;
}