参考代码:
#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { if(n==0) break; map<string,int>mp; for(int i=0;i<n;i++) { string s; cin>>s; mp[s]++; } int max=0; for(auto p:mp) { if(p.second>max) max=p.second; } for(auto p:mp) { if(p.second==max) { cout<<p.first<<endl; break; } } } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:908 |
Cylinder (C语言描述+详细分析)浏览:3330 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:510 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:666 |
C二级辅导-等差数列 (C语言代码)浏览:792 |
时间转换 (C语言代码)浏览:684 |
单词个数统计 (C语言代码)浏览:1043 |
陶陶摘苹果2 (C语言代码)浏览:640 |
C语言训练-8除不尽的数 (C语言代码)浏览:1459 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:650 |