标签:stl
1代码:
#include<set>
#include<string>
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
set<string> st;
multiset<string> mst;
int main()
{
int n;
string s;
while(scanf("%d",&n)&&n)
{
st.clear();
mst.clear();
for(int i=0; i<n; i++)
{
cin>>s;
st.insert(s);
mst.insert(s);
}
set<string>::iterator it;
int maxx=-1;
for(it=st.begin(); it!=st.end(); it++)
{
int cnt=mst.count(*it);
if(cnt>maxx)
{
maxx=cnt;
s=*it;
}
}
cout<<s<<endl;
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
hdu 1004 Let the Balloon Rise(STL)
标签:stl
原文地址:http://blog.csdn.net/xky1306102chenhong/article/details/47442873