#include<iostream> #include<string> #include<stdlib.h> using namespace std; void main(){ int n; while(cin>>n){ if(n==0) break; string str[1001]; string str1; int s[1001]; int z=0; memset(s,0,sizeof(s)); int count=0; for(int i=0;i<n;++i){ cin>>str1; bool t=true; for(int j=0;j<=i;++j){ if(str1==str[j]) { s[j]++; t=false; break; } } if(t){ s[z]++; str[z++]=str1; } } int max=0; int maxb=0; for(int b=0;b<z;++b){ if(s[b]>max) { max=s[b]; maxb=b; } } cout<<str[maxb]<<endl; } }
杭电ACM 第1004题
最新推荐文章于 2021-05-22 19:50:08 发布