/** HDOJ----1004(Let the Balloon Rise) */ #include<stdio h=""> #include<string h=""> int main() { int n,i,j,count=0,max; char ballon[1000][15]; int num[1000]; char temp[15];/** 缓存输入的气球颜色。*/ int flag; while(scanf("%d",&n)&&n!=0) { memset(num,0,1000);/**作用是在一段内存块中填充某个给定的值 */ count=0; for(i=0;i<n;i++) { scanf("%s",temp); flag=0; for(j=0;j<i;j++) { if (strcmp(ballon[j],temp)==0) { num[j]++; flag=1; } } if(!flag) { strcpy(ballon[i],temp); count++; num[i]++; } } max=0; for(i=0,j=0;i<count;i++) if (max<num[i]) { max=num[i]; j=i; } printf("%s\n",ballon[j]); } return 0; } </string></stdio>