HDU 1004 Let the Balloon Rise
阿新 • • 發佈:2018-07-22
second div pre code namespace stream http return first
1 #include<iostream> 2 #include<cstdio> 3 #include<map> 4 using namespace std; 5 int n; 6 string s; 7 map<string,int>m; 8 int main() 9 { 10 while(scanf("%d",&n)&&n) 11 { 12 m.clear(); 13 for(int i=1;i<=n;i++) 14 { 15 cin>>s;16 m[s]++; 17 } 18 map<string,int>::iterator ans=m.begin(),it; 19 for(it=m.begin();it!=m.end();it++) 20 if(it->second>ans->second) 21 ans=it; 22 cout<<ans->first<<endl; 23 } 24 return 0; 25 }
HDU 1004 Let the Balloon Rise