标签:style blog class code c java
注意是>=
//#define LOCAL #include<cstdio> #include<iostream> #include<map> #include<string> #include<algorithm> using namespace std; int T,maxx; std::map<string,int> word_count; std::map<string,int>::iterator be,ed,result; string word; void solve() { while(scanf("%d\n",&T)&&T!=0) { for(int i=0;i<T;i++) { getline(cin,word,‘\n‘); word_count[word]++; } be=word_count.begin(); ed=word_count.end(); maxx=0; while(be!=ed) { if(be->second>=maxx) { result=be; maxx=be->second; } be++; } cout<<result->first<<endl; word_count.clear(); } } int main() { #ifdef LOCAL freopen("1004.in","r",stdin); freopen("1004.out","w",stdout); #endif solve(); return 0; }
标签:style blog class code c java
原文地址:http://www.cnblogs.com/jianfengyun/p/3726370.html