Let the Balloon Rise
Total Submission(s): 123029 Accepted Submission(s): 48464
This year, they decide to leave this lovely job to you.
A test case with N = 0 terminates the input and this test case is not to be processed.
5 green red blue red red 3 pink orange pink 0
red pink
///AC代码
#include <iostream>
#include <set>
#include <map>
#include <stack>
#include <cmath>
#include <queue>
#include <cstdio>
#include <bitset>
#include <string>
#include <vector>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <functional>
#define PI acos(-1)
#define eps 1e-8
#define inf 0x3f3f3f3f
#define debug(x) cout<<"---"<<x<<"---"<<endl
typedef long long ll;
using namespace std;
map<string, int> p;
map<string, int>:: iterator iter;
int main()
{
int n;
while (cin >> n && n)
{
p.clear();
string s;
for (int i = 0; i < n; i++)
{
cin >> s;
p[s] += 1;
}
string sum;
int gg = 0;
for (iter = p.begin(); iter != p.end(); iter++)
{
if ((iter->second) > gg)
{
gg = iter->second;
sum = iter->first;
}
}
cout << sum << endl;
}
return 0;
}
415




被折叠的 条评论
为什么被折叠?



