#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main(){
struct col{
char ch[16];
int num;
struct col *next;
} *head,*tail,*p,*q;
int n,i,count,max;
char str[16];
char m[16];
while(scanf("%d",&n)&&n){
head = tail = NULL;
count = 0;
while(n--){
scanf("%s",str);
max = 0;
strcpy(m,str);
for(q = head;q!=NULL;q = q->next){
if(strcmp(str,q->ch) == 0) q->num++;
if(n == 0&&q->num>max) {
max = q->num;
strcpy(m,q->ch);
}
}
if(q == NULL)
{ p = (struct col *)malloc(sizeof(struct col));
strcpy(p->ch,str);
p->num = 0;
p->next = NULL;
if(head == NULL)
head = p;
else tail->next = p;
tail = p;
}
}
printf("%s\n",m);
}
return 0;}
zoj 2104 Let the Balloon Rise
最新推荐文章于 2020-08-21 23:37:45 发布