Let the Balloon Rise

Let the Balloon Rise

# include<stdio.h>
# include<map>
# include<string>
# include<iostream>
using namespace std;
int main(){
	map<string,int>bn;
	int n;
	string str;
	while(scanf("%d",&n)!=EOF){
		if(n==0){
			break;
		}
		bn.clear();
		while(n--){
			cin>>str;
			bn[str]++;
		}
		int max=0;
		string maxcolor;
		map<string,int>::iterator iter;
		for(iter=bn.begin();iter!=bn.end();iter++){
			if(iter->second>max){
				max=(*iter).second;
				maxcolor=(*iter).first;
			}
		}
	cout<<maxcolor<<endl;
}
return 0;
}

 

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-06-15
  • 2021-12-21
  • 2021-11-05
猜你喜欢
  • 2021-11-03
  • 2022-01-19
相关资源
相似解决方案