HDU 1004

第一次写map   纪念

1
#include <map> 2 #include <cstdio> 3 #include <iostream> 4 #include <string> 5 #include <cstring> 6 #include <string.h> 7 using namespace std; 8 map<string,int> a; 9 int main(){ 10 int t,max1; 11 string s,k; 12 while(scanf("%d",&t)!=EOF){ 13 if(t==0)break; 14 max1=0; 15 while(t--){ 16 cin>>s; 17 a[s]++; 18 if(a[s]>max1){max1=a[s];k=s;} 19 } 20 cout<<k<<endl; 21 } 22 return 0; 23 }

 

posted @ 2014-07-31 22:59  Mr.XuJH  阅读(129)  评论(0编辑  收藏  举报