简单题
#include<iostream>#include<map>#include<string>using namespace std;int main(){ int N;string str; map<string, int> tmp; while (cin >> N&&N != 0) { int s_max = 0;string re;//记录最大次数和对应的颜色 while (N--) { cin >> str; if (++tmp[str] > s_max) { s_max = tmp[str];re = str; } } cout << re << endl; tmp.clear(); }}新闻热点
疑难解答