1004 ( Let the Balloon Rise )

 1 #include <iostream>
 2 #include <map>
 3 #include <String>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int N;
10     while((cin>>N),N){
11         map<string, int> balloon;
12         string color;    
13         for(int i=0; i<N; i++){
14             cin>>color;
15             balloon[color]++;
16         }
17         
18         int maxcount=0;
19         for(map <string, int>::iterator  it=balloon.begin();it!= balloon.end( ); it++){
20             if(maxcount<it->second){
21                 color=it->first;
22                 maxcount=it->second;
23             }
24         }
25         cout<<color<<endl;
26     }
27     return 0;
28 }
原文地址:https://www.cnblogs.com/manhua/p/3060667.html