#include<iostream> using namespace std; #include<string> #include<map> int main() { int n,i; map<string,int> ball; while( cin >> n) { if(n==0)break; ball.clear(); string color,pcolor; for( i = 0;i<n;i ++) { cin >> color; if(ball.count(color)==0) { ball.insert(pair<string,int>(color,1)); } else { ball[color]++; } } map<string,int>::iterator it; int count = -1; for( it=ball.begin();it!=ball.end();it++) { if((*it).second>count) { count = (*it).second; pcolor = (*it).first; } } cout << pcolor << endl; } system("pause"); }
hdoj1004
最新推荐文章于 2021-02-03 13:18:40 发布