semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int n=1,m;
struct zuozhe
{int num;
char ren[26];
struct zuozhe *next;
};
struct zuozhe *ap()
{
	struct zuozhe * head,*nw,*tn;
	do
	{
		nw=(struct zuozhe *)malloc(sizeof(struct zuozhe));
		scanf("%d%s",&nw->num ,nw->ren );
		if(n==1)
		{
			head=nw;
			tn=head;
		}
		else
			tn->next=nw;
		if(n<=m)
		{
			tn=nw;
			n++;
		}
	}while(n<=m);
	tn->next =NULL;
	return head;
}
int main()
{
	int i,max=0,a[26]={0},j,w,l;
	char z;
	struct zuozhe *head,*p;
	scanf("%d",&m);
	head=ap();
	p=head;
	for(;p!=NULL;p=p->next )
	{
		l=strlen(p->ren );
		for(i=0;i<l;i++)
		{
			j=p->ren [i]-65;
			a[j]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(max<a[i])
		{
			max=a[i];
			w=i;
		}
	}
	z=65+w;
	printf("%c\n%d\n",z,max);
	p=head;
	for(;p!=NULL;p=p->next )
	{
		l=strlen(p->ren );
		for(i=0;i<l;i++)
		{
			if(p->ren [i]==z)
			{
				printf("%d\n",p->num );
				break;
			}
		}
	}
}
//????
int main()
{
	int a,s[26][1000],m,i,j,author,max=0;//a????
	char b[1000][28];//???
	for (i=0;i<26;i++)
		s[i][0]=0;
	cin>>m;
	for (i=0;i<m;i++)
	{
		cin>>a;
		cin>>b[a];
		for (j=0;b[a][j]!='\0';j++)
		{
			s[b[a][j]-'A'][0]++;//??????+1
			s[b[a][j]-'A'][s[b[a][j]-'A'][0]]=a;//??????
		}
	}
	for (i=0;i<26;i++)
	{
		if (s[i][0]>max)
		{
			max=s[i][0];
			author=i;
		}
	}			
	cout<<(char)(author+'A')<<endl<<max<<endl;
	for (j=1;j<=max;j++)
		cout<<s[author][j]<<endl;
	return 0;
}
struct info
{
	int num;
	char author[30];
	struct info *next;
};
struct info*create(int n)
{
struct info *p1,*p2,*head;
int i;
p1=(struct info*)malloc(sizeof(struct info));
scanf("%d%s",&p1->num,p1->author);
p1->next=NULL;
p2=p1;
head=p1;
i=1;
while(i<n)
{
	p1=(struct info*)malloc(sizeof(struct info));
    scanf("%d%s",&p1->num,p1->author);
	p1->next=NULL;
	p2->next=p1;
	p2=p1;
	i++;
}
return head;
}



int main()
{
	int n,i,t,index,j;
	struct info *head,*p;
	int *g;
	scanf("%d",&n);
	head=create(n);
	g=(int*)malloc(26*sizeof(int));
	p=head;
    for(i=0,t=0;i<26;i++)
	{
	*(g+i)=0;
	}
	for(i=0;i<n;i++)
	{
		j=0;
		while(*(p->author+j)!='\0')
		{(*(g+(*(p->author+j))-65))++;j++;}
		p=p->next;
	}
    for(i=0,t=0;i<26;i++)
	{
	if(*(g+i)>t)
	{t=*(g+i);index=i;}
	}
    printf("%c\n",index+65);
	printf("%d\n",*(g+index));
    p=head;
	for(i=0;i<n;i++)
	{
		j=0;
		while(*(p->author+j)!='\0')
		{if(*(p->author+j)==index+65)
		{printf("%d\n",p->num);}
		j++;
		}
		p=p->next;
	}
}
struct data{
int code;
char author[20];
};
struct letter{
char let;
int count;
};

int main()
{
int n,i,j,k,t,max;
struct data a[100];
struct letter l[26];

scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i].code);        
gets(a[i].author);
}
for(i=0;i<26;i++)
{
l[i].let=i+65;              
l[i].count=0;
}

for(i=0;i<n;i++)
{
for(j=0;a[i].author[j]!='\0';j++)             
{
for(k=0;k<26;k++)
{
if(a[i].author[j]==l[k].let)
l[k].count++;
}
}
}
   max=0;
   for(k=0;k<26;k++)                        {
   if(l[k].count>max)
   { max=l[k].count;
   t=k;}
   }

   printf("%c\n",l[t].let);
   printf("%d\n",l[t].count);
   for(i=0;i<=n-1;i++)               
   {
   for(j=0;a[i].author[j]!='\0';j++)
{
if(a[i].author[j]==l[t].let)
printf("%d\n",a[i].code);
}
   }   

return 0;
}
void main()
{
	int max(int b[26]);
	int n,a[100]={0},b[26]={0},i,j,m;
	char zuo[26]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
	char shu[100][10]={0},c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&a[i],shu[i]);
	}
	for(i=0;i<26;i++)
	{
		for(j=0;j<n;j++)
		{
			if(strchr(shu[j],zuo[i])) b[i]=b[i]+1;
		}
	}
	m=max(b);
	for(i=0;i<26;i++)
	{
		if(b[i]==m)
		{
			printf("%c\n",zuo[i]);
			printf("%d\n",b[i]);
			c=zuo[i];
		}
	}
	for(i=0;i<n;i++)
	{
		if(strchr(shu[i],c))
		{
			printf("%d\n",a[i]);
		}
	}
}
int max(int b[26])
{
	int i,m=0;
	for(i=0;i<26;i++)
	{
		if(m<b[i])m=b[i];
	}
	return(m);
}
struct book
{
	int num;
	char author[26];
};
int main()
{
	int n;
	scanf("%d\n",&n);
	int i;
	struct book book[1000];
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&book[i].num,book[i].author);
	}
    int b[26]={0};
	for(i=0;i<n;i++)
	{
		int l;
		l=strlen(book[i].author);
		int j;
		for(j=0;j<l;j++)
		{
			b[book[i].author[j]-65]=b[book[i].author[j]-65]+1;
		}
	}
	int max=b[0];
	for(i=0;i<26;i++)
	{
		if(b[i]>max) max=b[i];
	}
    for(i=0;i<26;i++)
	{
		if(b[i]==max) break;
	}
	char p;
	p=i+65;
	printf("%c\n%d\n",p,max);
	for(i=0;i<n;i++)
	{   int j,l;
		l=strlen(book[i].author);
		for(j=0;j<l;j++)
		{
			if(book[i].author[j]==p) {printf("%d\n",book[i].num);break;}
			else if(book[i].author[j]!=p&&j==l-1) break;
		}
	}
	return 0;
}/*????????*/
struct BOOK
{
	int num;
	char author[26];
};

char maxbook(int a[])
{
	int i,j,bookmax=0;
	for(i=0;i<26;i++){
		if(bookmax<a[i]){
			bookmax=a[i];
			j=i;
		}
	}
	printf("%c\n%d\n",'A'+j,bookmax);
	return 'A'+j;
}

int contain(char author[],char max)
{
	char *c=author;
	while(*c){
		if(*c==max) return 1;
		c++;
	}
	return 0;
}

void main()
{
	struct BOOK book[1000];
	int m,i,j;
	char c,max;
	int AtoZ[26]={0};

	scanf("%d",&m);

	for(i=0;i<m;i++){
		scanf("%d",&book[i].num);
		getchar();
		j=0;
		while((c=getchar())!='\n'){
			book[i].author[j]=c;
			AtoZ[c-'A']++;
			j++;			
		}
		book[i].author[j]='\0';
	}
	max=maxbook(AtoZ);

	for(i=0;i<m;i++){
		if(contain(book[i].author,max))
			printf("%d\n",book[i].num);
	}
}
int main()
{
  int m ;
  cin >> m ;
  int p ;
  char a[m+1][27];
  int len[m +1];
  int b[m+1];
  int c[26];
  int i , j , k  ,l ;
  for( i = 0 ;i <=25 ; i++ )
       c[i] = 0 ;
       for( i = 1 ; i <= m ; i ++ )
        {
              cin >> b[i];
               cin >> a[i] ;
                  len[i] = strlen(a[i]);
                  for( j = 0; j <= len[i] -1 ; j ++ )
                  {
                         c[a[i][j] - 'A']++ ;     
                  } 
          }
  int temp = -1 ;
  for( i = 0; i<= 25 ; i ++ )
  {
    if( c[i]> temp )
    {
       temp = c[i] ;
       p = i ; 
    }
  }
  char n = 'A'+ p ;
  cout << n << endl ;
  cout << temp << endl ;
  for( i = 1; i <= m ; i ++ )
   for ( j = 0 ; j<= len[i] -1 ; j ++ )
   {
         if(a[i][j] == '\0')
         {
          break ;
         }
         else if(a[i][j] == n)
         {
          cout << b[i]<<endl;    
          break ;
         }
   }
   return 0 ;
}
struct a
{
	int book;
	char author[26];
	struct a *next;
};
struct a *creat(int m)
{
	int i=0;
	struct a *p,*head,*temp;
	head=NULL;
	do
	{
		p=(struct a *)malloc(sizeof(struct a));
			if(p==NULL){
			exit(1);
			}
			scanf("%d %s",&p->book,p->author);
			if(head==NULL){
			head=p;
			temp=p;}
			else{
				temp->next=p;
				temp=p;
			}
			i++;
	}while(i<m);
temp->next=NULL;
				return(head);
}
void main()
{
	int h,m,i,j,zimu[26]={0};
	struct a *head,*p;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++){
			if(p->author[j]>='A'&&p->author[j]<='Z')
			{
		zimu[p->author[j]-'A']++;
			}
		}
		p=p->next;
	}
	h=0;
	for(i=0;i<26;i++)
	{
		if(zimu[i]>zimu[h])
			h=i;
	}
	printf("%c\n%d\n",'A'+h,zimu[h]);
	p=head;
		for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++){
			if(p->author[j]=='A'+h)
			{
				printf("%d\n",p->book);
				break;
			}
		}
		p=p->next;
	}
}
int main()
{
 int b[26]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 int m,i,j,k,num[10000],max=0,t=0;
 char a[10000][26];
 char c[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
 scanf("%d",&m);
 for(i=0;i<m;i++)
 {
  scanf("%d",&num[i]);
  scanf("%s",&a[i]);                
 }
 for(i=0;i<m;i++)
 {
  for(j=0;j<26;j++)
  {
   for(k=0;k<26;k++)
   {
    if(a[i][j]==c[k])
    b[k]++;
   }                 
  }                
 }
 for(i=0;i<26;i++)
 {
  if(b[i]>max)
  {
   max=b[i];                 
   t=i;
  }
 }
 printf("%c\n",c[t]);
 printf("%d\n",max);
 for(i=0;i<m;i++)
 {
  for(j=0;j<26;j++)
  {
    if(a[i][j]==c[t])
    {
     printf("%d\n",num[i]);
     break;                 
    }                 
  }                
 }
 
 getchar();
 getchar();
 return 0;   
}
struct student
{
	char number[100];
	char name[100];
	struct student*next;
};
int n;
struct student*creat(void)
{
	struct student *head;
	struct student *p1,*p2;
	int i=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%s %s",&p1->number,&p1->name);
    head=NULL;
	do
	{
		i=i+1;
		if(i==1)head=p1;else p2->next=p1;
		p2=p1;
		p1=(struct student*)malloc(LEN);
		scanf("%s %s",&p1->number,&p1->name);
	}
	while(i<n-1);
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	return(head);
}
void main()
{
	int h,i,k,m,j,max;
	struct student*head;
	struct student*p; 
	int sum[10000]={0};
	scanf("%d",&n);
	head=creat();/*????*/
	p=head;
	for(i=65,k=0;i<=90;i++,k++)/*???????????????*/
	{
		p=head;
     do
	 {
		     m=strlen(p->name);
			 for(j=0;j<m;j++)
			 {
				 if(p->name[j]==i)sum[k]++;
			 }
			 p=p->next;
	 }while(p!=NULL);
	}
	for(i=0,max=sum[0];i<=k;i++)
	{
		if(sum[i]>=max){h=i;max=sum[i];}/*??????????????????????????????????????*/
	}
	 printf("%c\n%d\n",h+65,max);/*???????????max??????sum[i]?????*/
	 p=head;
	 do
	 {
		     m=strlen(p->name);
			 for(j=0;j<m;j++)
			 {
				 if(p->name[j]==h+65)printf("%s\n",p->number);
			 }
			 p=p->next;
	 }while(p!=NULL);
}
/*?????????????????????????????????????????????????????????????????
???????????????????????????????????????????*/
int main()
{
  int m,i,j,k,q=0,t=0,u,max;
  int b[26]={0};
  char c[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  struct as{
    int sh;
    char a[26];
  }cla[1000];
  scanf("%d",&m);
  for(i=0;i<m;i++){
   scanf("%d %s",&cla[i].sh,cla[i].a);
   t=(int)strlen(cla[i].a);
   for(k=0;k<t;k++){
    u=cla[i].a[k]-'A';
    b[u]++;
   }
  }
  max=0;
  for(j=0;j<25;j++)
    if(max<b[j]){
      max=b[j];
      q=j;
    }  
  printf("%c\n",c[q]);
  printf("%d\n",max);
  for(i=0;i<m;i++){
   t=(int)strlen(cla[i].a);
     for(k=0;k<t;k++)
      if(cla[i].a[k]==c[q])
       printf("%d\n",cla[i].sh);
  }
  return 0;
}
struct book
{
	int num;
	char author[26];
	struct book *next;
};
void main()
{
	int m,i,j,l,max,maxi;int n[26]={0};
	struct book *head,*p1,*p2;char *p;
	scanf("%d",&m);
	i=0;
	p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->author);
	head=NULL;
	while(i<m)
	{
		i++;
		if(i==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		if(i<m)
		{
			p1=(struct book *)malloc(LEN);
			scanf("%d %s",&p1->num,p1->author);
		}
	}
	p2->next=NULL;
	p1=head;
	while(p1!=NULL)
	{
		l=strlen(p1->author);
		p=p1->author;
		for(i=0;i<l;i++)
		{
			
			for(j=0;j<26;j++)
				if(*(p+i)==j+64)
					n[j]++;
		}
		p1=p1->next;
	}
	max=n[0];
	for(i=1;i<26;i++)
	{
		if(n[i]>max)
		{
			max=n[i];
			maxi=i;
		}
	}
	printf("%c\n",maxi+64);

	printf("%d\n",max);
	
	p1=head;
	while(p1!=NULL)
	{
        l=strlen(p1->author);
		p=p1->author;
		for(i=0;i<l;i++)
		{
			
				if(*(p+i)==maxi+64)
				{
					printf("%d\n",p1->num);
					break;
				}
		}
		p1=p1->next;
	}
}
struct su
{
	int a;
	char b[26];
    struct su *next;
};
int main()
{
	int n,c[26]={0},i,k,j,l,max,m;
	struct su *p,*head,*q;
	scanf("%d",&n);

    for(i=0;i<n;i++)
	{
		p=(struct su *)malloc(sizeof(struct su));
		if(i==0)
		{head=p;
		q=p;
		scanf("%d %s",&p->a,p->b);
		k=strlen(p->b);
			for(j=0;j<k;j++)
			{
                l=p->b[j]-'A';
				c[l]=c[l]+1;
			}
		}
       else
	   {	q->next=p;
		q=p;
		scanf("%d %s",&p->a,p->b);
	    k=strlen(p->b);
			for(j=0;j<k;j++)
			{
                l=p->b[j]-'A';
				c[l]=c[l]+1;
			}
	   }
        
	}
	q->next=NULL;
	max=c[0];
	m=0;
	for(j=0;j<26;j++)
	{
        if(max<c[j])
		{max=c[j];
		m=j;
		}

	}
	printf("%c\n%d\n",m+'A',max);
	p=head;
	do
	{
        k=strlen(p->b);
		for(j=0;j<k;j++)
		{
			if(('A'+m)==p->b[j])
			{
				printf("%d\n",p->a);
			}
		}
		p=p->next;
	}while(p!=NULL);



 

return 0;
}
int main()
{
    int n,i,j,k,max;
    char name[2000][30],alp[27]={"ABCDEFGHIJKLMNOPQRSTUVWXYZ"};
    int No[2000],num[30]={0};
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d %s",&No[i],name[i]);       
    }
    for(i=0;i<26;i++){               
        for(k=0;k<n;k++){
            for(j=0;j<strlen(name[k]);j++){
                if(name[k][j]==alp[i]){
                    num[i]++;
                    break;
                }
            }
        }
    }
    max=num[0];
    for(i=1;i<26;i++){
        if(num[i]>max){
            max=num[i];
        }
    }
    for(i=0;i<26;i++){ 
        if(num[i]==max){
            printf("%c\n%d\n",alp[i],max);
            for(k=0;k<n;k++){
                for(j=0;j<27;j++){
                    if(name[k][j]==alp[i]){
                        printf("%d\n",No[k]);
                        break;
                    }
                }
            }
        }
    }
    return 0;
}
int main()
{struct book{
	int num;
	char s[26];
}b[1000];
struct author{
	int n[1000];
	int p;
	char c;
}a[26],e;

int i,j,k,m,q,max;
char d;
for(i=0;i<26;i++)
	a[i].p=0;
for(i=0,d='A';i<26;i++,d++)
{a[i].c=d;}
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&b[i].num,b[i].s);}
for(i=0;i<m;i++)
{for(j=0;;j++)
{if(b[i].s[j]=='\0')
	break;
for(k=0;k<26;k++)
{if(b[i].s[j]==a[k].c)
{a[k].n[a[k].p]=b[i].num;
a[k].p+=1;}}}}
max=a[0].p;
e=a[0];
for(i=0;i<26;i++)
{if(a[i].p>max)
{e=a[i];max=a[i].p;}}
printf("%c\n",e.c);
printf("%d\n",e.p);
for(j=0;j<e.p;j++)
	printf("%d\n",e.n[j]);}
void main()
{
	int n,i,j,k,a[1000],max=0,t,p[26]={0};
	char c[1000][27],d,l[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d %s",&a[i],c[i]);
	for(i=0;i<n;i++)
		for(j=0;j<strlen(c[i]);j++)
			for(k=0;k<26;k++){
				if(c[i][j]==l[k])
					p[k]+=1;
		}
	for(k=0;k<26;k++)
		if(p[k]>max){max=p[k];t=k;}
		printf("%c\n%d\n",l[t],max);
	for(i=0;i<n;i++)
		for(j=0;j<strlen(c[i]);j++)
			if(c[i][j]==l[t]){
				printf("%d\n",a[i]);
			break;}
	
}
int main()
{
	int n,i,j,num[1000],l[1000],count[128],m,max;
	char edi[1000][26],au[128];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("\n%d",&num[j]);
		gets(edi[j]);
		l[j]=strlen(edi[j]);
	}
	for(i=0;i<128;i++)
		count[i]=0;
	for(j=0;j<n;j++)
	{
		for(i=1;i<l[j];i++)
		{
			m=edi[j][i];
			au[m]=edi[j][i];
			count[m]++;
		}
	}
	max=0;
	for(i=0;i<128;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			m=i;
		}
	}
	printf("%c\n%d",au[m],max);
	for(j=0;j<n;j++)
	{
		for(i=1;i<l[j];i++)
		{
			if(edi[j][i]==au[m])
				printf("\n%d",num[j]);
		}
	}
	return 0;
}
struct book
{  int n;
   char name[26];
   struct book *next;
};
struct book *head;
int m;
struct book *creat()
{struct book *p1,*p2;
 int i=0;
 p1=p2=(struct book*)malloc(LEN);
 scanf("%d %s",&p1->n,p1->name);
 head=NULL;
 while(i<m-1)
 {i=i+1;
 if(i==1) head=p1;
 else p2->next=p1;
 p2=p1;
 p1=(struct book*)malloc(LEN);
 scanf("%d %s",&p1->n,p1->name);
 }
 p2->next=p1;
 p1->next=NULL;
 return(head);
}
void main()
{
	int i,j,*p,max=0,n;
	struct book *p1;
	p=(int*)calloc(26,sizeof(int));
	scanf("%d",&m);
	creat();
	p1=head;
	for(i=65;i<=90;i++)
	{
		p1=head;
		do
		{
		for(j=0;(p1->name)[j]!='\0';j++)
			if((p1->name)[j]==i) *(p+i-65)=*(p+i-65)+1;
		p1=p1->next;
		}while(p1!=NULL);
	}
	for(i=0;i<26;i++,p++)
	{
		if(*p>max)
		{
			max=*p;
			n=i;
		}
	}
	printf("%c\n",n+65);
	printf("%d\n",max);
	p1=head;
	do
	{
      for(j=0;(p1->name)[j]!='\0';j++)
	  {    
		  if((p1->name)[j]==n+65) 
			  printf("%d\n",p1->n);
	  }
		p1=p1->next;
	}while(p1!=NULL);
}
struct book
{
	int name;  
	char writer[26];
};
void main()
{
	struct book data[999];
	int m,i,j,max=0,b=0;
	int a[26]={0};
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d %s",&data[i].name,data[i].writer);
    for(i=0;i<m;i++)
		for(j=0;j<strlen(data[i].writer);j++)
			a[data[i].writer[j]-'A']++;
    for(i=0;i<26;i++)
		if(a[i]>max)  
		{max=a[i];
		b=i;}
	printf("%c\n%d\n",('A'+b),max);
	for(i=0;i<m;i++)	
		for(j=0;j<strlen(data[i].writer);j++)
		{if(data[i].writer[j]==('A'+b))
		{
		printf("%d\n",data[i].name);
			break;}
	}
}
struct author
{
    char name;
    int count;
}aut[26];

int max(struct author a[26])
{
    int i,max;
    max=a[0].count;
    for(i=0;i<26;i++)
        if(a[i].count>max)
            max=a[i].count;
    return(max);
}
void main()
{
    int m,h=0;
    scanf("%d",&m);
    int i,j,n,l[1000],book_name[1000];
    char author_name[1000][27];
    for(i=0;i<26;i++)
    {
    aut[i].name='A'+i;
    aut[i].count=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%s",&book_name[i],author_name[i]);
        l[i]=strlen(author_name[i]);
        for(j=0;j<26;j++)
        for(n=0;n<l[i];n++)
                if(author_name[i][n]==aut[j].name)
                aut[j].count++;
    }
    for(i=0;i<26;i++)
    {
        if(aut[i].count==max(aut))
        {    
            printf("%c\n",aut[i].name);
            h=i;
        }
    }
    printf("%d\n",max(aut));
    for(i=0;i<m;i++)
    {
        l[i]=strlen(author_name[i]);
        for(n=0;n<l[i];n++)
            if(author_name[i][n]==aut[h].name)
                printf("%d\n",book_name[i]);
    }
}
void main()
{
	int j,n,i,book,max=0,pos,a[30][1000]={0};
	char s[100];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
	  scanf("%d%s",&book,&s);
	  for (j=0;j<strlen(s);j++)
	  {
		  a[s[j]-'A'][0]++;
		  a[s[j]-'A'][a[s[j]-'A'][0]]=book;
	  }
	}
	for (i=0;i<26;i++)
		if (a[i][0]>max)
		{
			max=a[i][0];
			pos=i;
		}
	printf("%c\n%d\n",pos+'A',a[pos][0]);
	for (i=1;i<=a[pos][0];i++)
		printf("%d\n",a[pos][i]);
}
struct  book  
{
    int  num;
    char  name[27];
    struct  book  *next;
};
   int  m;
struct  book   *head;   
   
struct   book  *setup()
{   int  t=0;
    struct  book  *head,*p1,*p2;
    head=p1=p2=(struct  book  *)malloc(sizeof  (struct  book));
    scanf("%d %s",&p1->num,p1->name);
    while(t<m-1)
    {   t++;
        p2->next=p1;
        p2=p1;
        p1=(struct  book  *)malloc(sizeof(struct  book));
        scanf("%d %s",&p1->num,p1->name);
    }
    p2->next=p1;
    p1->next=NULL;
    return(head);
}
   int   k=0,max=0;
void   found(struct  book  *p)
{     int  i,j;
      p=head;
      int  *pi;
      pi=(int *)malloc(sizeof(int)*26);
      for(i=0;i<26;i++)  *(pi+i)=0;
      for(i=0;i<m;i++)
         {
              for(j=0;p->name[j]!='\0';j++)
              {       
                         (*(pi+(p->name[j]-'A')))++;
              }
             p=p->next;
         }  
         for(j=0;j<26;j++)
          {  
                  if(*(pi+j)>max){
                   max=*(pi+j);
                   k=j;
                   }
          } 
          
}          
      int  main()
{   int  i,j;
    scanf("%d",&m);
    struct book *p;
     head=p=setup();
     found(p);
     printf("%c\n%d\n",(k+'A'),max); 
     p=head;
     for(i=0;i<m;i++)
        {for(j=0;p->name[j]!='\0';j++)
           if(p->name[j]==k+'A'){
           printf("%d\n",p->num);
           break;
           }
           p=p->next;
        }  
}
int main ()
{
	int n,i,j,m,t,g,max;
	char q;
	int d[26];
	struct
	{
		int a;
		char b[26];

	}s[999];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&s[i].a,s[i].b);
	}
	for(i=0;i<26;i++)
	{
		d[i]=0;
	}
	for(i=0;i<n;i++)
	{
		m=strlen(s[i].b);
		for(j=0;j<m;j++)
		{
			t=s[i].b[j]-'A';
			d[t]++;
		}
	}
	max=0;
	for(j=0;j<25;j++)
	{
		if(d[j]>max)
		{
			max=d[j];
			g=j;
		}
	}
	q='A'+g;
	printf("%c\n%d\n",q,max);

	for(i=0;i<n;i++)
	{
		m=strlen(s[i].b);
		for(j=0;j<m;j++)
		{
			if(s[i].b[j]-'A'==g)
			{
				printf("%d\n",s[i].a);
			}
		}
	}



		return 0;

}
struct Student
{char name[26];
 int a;
};
int main()
{
	int n,i,k,l,m;
	char j,t;
	int b[26]={0};
	scanf ("%d",&n);
	struct Student stu[999];
	for (i=0;i<n;i++)
	{
		scanf ("%d %s",&stu[i].a,stu[i].name);
	}
	for (j='A',k=0;j<='Z';j++,k++)
		for (i=0;i<n;i++)
			for (l=0;l<26;l++)
				if (stu[i].name[l]==j)
					b[k]++;
	for (j='A',k=0,m=0;j<='Z';j++,k++)
		if (b[k]>m)
		{
			m=b[k];
		    t=j;
		}
	printf ("%c\n%d",t,m);
	for (i=0;i<n;i++)
		for (l=0;l<26;l++)
			if (stu[i].name[l]==t)
				printf ("\n%d",stu[i].a);
	return 0;
}
int main()
{
  char mo='A';
  int a[ASC]={0};
  int i,j,n;

 struct
{ int num;
  char wr[MAX_N+1];
}book[MAX_M];

scanf("%d",&n);
for(i=0;i<n;i++)
{scanf("%d%s",&book[i].num,book[i].wr);
 for(j=0;book[i].wr[j];j++)
{if(++a[book[i].wr[j]]>a[mo]) mo=book[i].wr[j];}
}
printf("%c\n%d\n",mo,a[mo]);
for(i=0;i<n;i++)
if(strchr(book[i].wr,mo)) printf("%d\n",book[i].num);
return 0;
}
void main()
{
	int n,i,c[26]={0},d[26]={0},j,s,t,k;
	char b[26000],r,max;
	scanf("%d\n",&n);
	struct book
	{
		int num;
		char author[26];
	}a[999];
	for(i=0;i<n;i++) scanf("%d %s\n",&a[i].num,&a[i].author);
    strcpy(b,a[0].author);
	for(i=1;i<n;i++) strcat(b,a[i].author);
	s=strlen(b);
	for(r='A',j=0;r<='Z',j<26;r++,j++)
		for(i=0;i<s;i++) if(b[i]==r) c[j]++;
	for(i=0;i<26;i++) d[i]=c[i];
	for(j=0;j<25;j++)
		for(i=0;i<25-j;i++)
			if(d[i]<d[i+1]) {t=d[i];d[i]=d[i+1];d[i+1]=t;}
    k=d[0];
	for(i=0;i<26;i++) if(c[i]==k) max=i+65;
	printf("%c\n%d\n",max,k);
	for(i=0;i<n;i++) 
		for(j=0;j<26;j++)
		   if(a[i].author[j]==max) printf("%d\n",a[i].num);
}
void main()
{
	int n,i,j,t[26]={0},k=0,max,h;
	scanf("%d",&n);
    
	struct book
	{
		int a;
		char b[26];
	}book[100]={0,""};


	for(i=0;i<n;i++)
	{
		scanf("%d%s",&book[i].a,book[i].b);
	}

	for(i=0;i<n;i++)
	{
		k=strlen(book[i].b);
		for(j=0;j<k;j++)
		{
			t[book[i].b[j]-65]++;
		}
	}
	max=0;
	for(i=0;i<26;i++)
	{
		//printf("%d ",t[i]);
		if(t[i]>max)
		{	max=t[i];
     		h=i;
		}
	}
	printf("%c\n%d\n",h+65,max);
	for(i=0;i<n;i++)
	{
		k=strlen(book[i].b);
		for(j=0;j<k;j++)
		{
			if(book[i].b[j]==h+65)
				printf("%d\n",book[i].a);
		}
	}

}
int main() 
{
    int n;
    int i,j,k;
    int max,max2; 
    int a[26]; 
    struct book
    {
           int number;
           char author[26];
    }stu1[1000];
    struct author
    {
           int number[1000];
           int ben; 
    }stu2[26];
           scanf("%d",&n); 
    for(i=0;i<=n-1;i++)
           scanf("%d %s",&stu1[i].number,stu1[i].author);
    for(i=0;i<=25;i++)
    {
           stu2[i].ben=0; 
           a[i]=0;
           } //??? 
          for(i=0;i<=n-1;i++)
           {
           for(j=0;j<=strlen(stu1[i].author)-1;j++)//j???????? 
           {
           k=stu1[i].author[j];//k???????? ?A? 
           stu2[k-65].ben++;//stu2[x]???1
           stu2[k-65].number[a[k-65]]=stu1[i].number;//??????????????
           a[k-65]++;//?????1
           }
           }
           max=stu2[0].ben;
           max2=0;//?A????? 
    for(i=1;i<=25;i++)
    {
           if(stu2[i].ben>max)
           { 
           max=stu2[i].ben;
           max2=i;//????????? 
           }
    } 
           printf("%c\n",max2+65);
           printf("%d\n",max);
           for(j=0;j<=a[max2]-1;j++) //????+1? ???? 
           printf("%d\n",stu2[max2].number[j]); 
                     return 0;
           }
void main()
{
	int n,i;
	scanf("%d",&n);
	int b[1000];
	char s[1000][26];
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&b[i],&s[i]);
	}
	int a[26]={0};
	char c[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	for(i=0;i<n;i++)
	{
		int l,j;
		l=strlen(s[i]);
		for(j=0;j<l;j++)
		{
			switch(s[i][j])
			{
				case'A':a[0]=a[0]+1;break;
				case'B':a[1]=a[1]+1;break;
				case'C':a[2]=a[2]+1;break;
				case'D':a[3]=a[3]+1;break;
				case'E':a[4]=a[4]+1;break;
				case'F':a[5]=a[5]+1;break;
				case'G':a[6]=a[6]+1;break;
				case'H':a[7]=a[7]+1;break;
				case'I':a[8]=a[8]+1;break;
				case'J':a[9]=a[9]+1;break;
				case'K':a[10]=a[10]+1;break;
				case'L':a[11]=a[11]+1;break;
				case'M':a[12]=a[12]+1;break;
				case'N':a[13]=a[13]+1;break;
				case'O':a[14]=a[14]+1;break;
				case'P':a[15]=a[15]+1;break;
				case'Q':a[16]=a[16]+1;break;
				case'R':a[17]=a[17]+1;break;
				case'S':a[18]=a[18]+1;break;
				case'T':a[19]=a[19]+1;break;
			    case'U':a[20]=a[20]+1;break;
				case'V':a[21]=a[21]+1;break;
				case'W':a[22]=a[22]+1;break;
				case'X':a[23]=a[23]+1;break;
				case'Y':a[24]=a[24]+1;break;				
				default:a[25]=a[25]+1;
			}
		}
	}
	int m;
	char z;
	m=a[0],z=c[0];
	for(i=1;i<26;i++)
	{
		if(a[i]>m)
			m=a[i],z=c[i];
	}
	printf("%c\n%d\n",z,m);
	for(i=0;i<n;i++)
	{
		int l,j;
		l=strlen(s[i]);
		for(j=0;j<l;j++)
		{
			if(s[i][j]==z)
			{
				printf("%d\n",b[i]);
				break;
			}
		}
	}
}