藜麦小笼包


私信TA

用户名:dotcpp0680909

访问量:445

签 名:

刁常潇

等  级
排  名 865
经  验 3537
参赛次数 0
文章发表 45
年  龄 18
在职情况 学生
学  校 山东管理学院
专  业 软件工程

  自我简介:

一名喜欢走捷径的程序猿

TA的其他文章

参考代码:

#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 人评分

  评论区

  • «
  • »