65,185
社区成员




#include <map>
#include <iostream>
#include <string>
using namespace std;
string foo(int n)
{
map<string , size_t> color_count;
string color;
string s;
for(int i = 0 ;i < n ;++i)
{
cin >> color ;
//在map中查找color,找到则将他出现的次数家一,没有找到则插入他,出现次数为一
++color_count[color];
}
size_t sum = 0;
for(const auto &c : color_count)
{
if(c.second > sum)
s = c.first;
}
return s;
}
int main()
{
int n;
string color;
while(cin >> n && n != 0)
{
color = foo(n);
cout << color << endl;
}
return 0;
}