semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct author
{
	int num;
	char aut[27];
}a[999];

void main()
{
	void search(struct author b[],int n,char marker);
	int m ,i,times[30]={0};
	int length=0,j;
	int max=0,flag=9;
	char chac;
	scanf("%d",&m);
//	printf("%d",m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&a[i].num,&a[i].aut);
	//	printf("%d %s",a[i].num,a[i].aut);
		length=strlen(a[i].aut);
		for(j=0;j<length;j++)
		{
			chac=a[i].aut[j];
			times[chac-'A']++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(max<times[i])
		{
			max=times[i];
			flag=i;
		}
	}
	printf("%c\n%d\n",(char)(flag+'A'),max);
	search(a,m,(char)(flag+'A'));
}

void search(struct author b[],int n,char marker)
{
	int i,j;
	for (i=0;i<n;i++)
	{
		for(j=0;j<strlen(b[i].aut);j++)
		{
			if(b[i].aut[j]==marker)
				printf("%d\n",b[i].num);
		}
	}
}
struct book
{
	int num;
	char name[20];
	struct book *next;
};
int i,j,n,t,number[100],m;
struct book *creat(void)
{
	struct book *p1,*p2,*head;
    p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->name);
	head=NULL;
	for(i=1;i<m;i++)
	{
		if(i==1)
			head=p1;
		else
			p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->name);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	return(head);
}
void main()
{
	scanf("%d",&m);
	struct book *creat(void);
	struct book *head,*p;
	int a[26]={0},max,maxindex=0;
	head=p=creat();
	char *pointer;
	do
	{
		for(pointer=p->name;*pointer!='\0';pointer++)
		{
			for(i=0;i<26;i++)
			{
				if(*pointer==65+i)
					a[i]++;
			}
		}
		p=p->next;
	}while(p!=NULL);
    max=a[0];
	for(i=1;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			maxindex=i;
		}
	}
	printf("%c\n%d\n",65+maxindex,a[maxindex]);	
	p=head;
	do
	{
		for(pointer=p->name;*pointer!='\0';pointer++)
		{
			if(*pointer==65+maxindex)
				printf("%d\n",p->num);
		}
		p=p->next;
	}while(p!=NULL);
}
int main()
{
	int m,n=0,book[1000],num[26]={0};
	char name[1000][10];
	cin>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>book[i]>>name[i];
	}
	for(char z='A';z<='Z';z++)
	{
		for(int i=1;i<=m;i++)
		{
			for(int j=0;j<10;j++)
				if(name[i][j]==z)num[z-'A']++;
		}
	}
	int max=0,k=0;
	for(int i=0;i<26;i++)
	{	if(max<num[i]){max=num[i];k=i;}}
	cout<<(char)('A'+k)<<endl<<max<<endl;
	for(int i=1;i<=m;i++)
		{
			for(int j=0;j<10;j++)
				if(name[i][j]=='A'+k)cout<<book[i]<<endl;
		}
	return 0;
}
struct
{
	int no;
	char wr[26];
}book[999];
struct
{
	char name;
	int num;
	int book[999];
}a[26];



int main()
{
	int n,m,t,k,d;
	int all=0;
	for (t=0;t<26;t++) 
	{
		a[t].name='A'+t;
		a[t].num=0;
	}
	scanf("%d",&m);
	for (t=0;t<m;t++)
	{
		scanf("%d %s",&book[t].no,book[t].wr);
	}

	for (t=0;t<m;t++)
	{
		k=strlen(book[t].wr);
		for(n=0;n<k;n++)
		{
			for(d=0;d<26;d++)
			{
				if (a[d].name==book[t].wr[n])
				{
					a[d].book[a[d].num]=book[t].no;
					a[d].num++;
					break;
				}
			}
		}
	}
	k=0;
	

	for (t=0;t<26;t++)
	{
		if (k<a[t].num)
            k=a[t].num;
	}


	for (t=0;;t++)
	{
		if (k==a[t].num) 
		{
			printf("%c",a[t].name);
			printf("\n%d",a[t].num);
			for (d=0;d<a[t].num;d++)
			printf("\n%d",a[t].book[d]);
			break;
		}
	}
}
struct book
{
int num;
char name[27];
struct book *next;
};


struct book *creat(int n)
{
 struct book *head,*p1,*p2;
 int m=0;
 head=p1=p2=NULL;
 p1=p2=(struct book *)malloc(sizeof(struct book));
 scanf("%d %s",&p1->num,p1->name);
 while(1)
 {
  m+=1;
  if(m>=n)break;
  if(m==1)head=p1;
  else p2->next=p1;
  p2=p1;
  p1=(struct book *)malloc(sizeof(struct book));
  scanf("%d %s",&p1->num,p1->name);
 }
p2->next=p1;
  p2=p1;
 p2->next=NULL;
 return(head);
}

 

void main()
{
 struct book *head,*p;
    char maxchar;
 int m,i=0,max=0,a[26]={0};
 scanf("%d",&m);
 head=creat(m);


 for(p=head;p!=NULL;p=p->next)
 {
	 //printf("%d,%s\n",p->num,p->name);
  for(i=0;p->name[i]!='\0';i++)
  {
   int c=p->name[i]-'A';
   a[c]++;
  }
 }

 for(i=0;i<26;i++)
 {
  if(a[i]>max)
  {
   max=a[i];
   maxchar='A'+i;
  }
 }

 printf("%c\n%d\n",maxchar,max);
 for(p=head;p!=NULL;p=p->next)
  for(i=0;p->name[i]!='\0';i++)
  {
   if(p->name[i]==maxchar)
   {
    printf("%d\n",p->num);
    break;
   }
  }
}
int trans(char k)
{
	int i;
	char a[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<26;i++)
	{
		if(k==a[i])
			return i;
	}
}
int main()
{
	struct books
	{
		int n;
		char w[27];
	}*m;
	int num,i,j;
	scanf("%d",&num);
	m=(struct books*)malloc(sizeof(struct books)*num);
	for(i=0;i<num;i++)
	{
		
		int N;
		char W[27];
		scanf("%d %s",&N,W);
		m[i].n=N;
		strcpy(m[i].w,W);
	}
	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},c;
	for(i=0;i<num;i++)
	{
		for(j=0;m[i].w[j]!='\0';j++)
		{
			c=trans(m[i].w[j]);
			b[c]++;
		}
	}
	int max=0;
	char most;
	for(i=0;i<26;i++)
	{
		if(b[i]>max)
		{
			max=b[i];
            most='A'+i;
		}
	}
	printf("%c\n%d\n",most,max);
	for(i=0;i<num;i++)
	{
		for(j=0;m[i].w[j]!='\0';j++)
		{
			if(m[i].w[j]==most)
				printf("%d\n",m[i].n);
		}
	}
	return 0;
}
int main()
{
    int n,a[999],i,k[27]={0},j,t,m;
    char b[999][27];
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d %s",&a[i],b[i]);
        for(j=0;b[i][j];j++)
        k[b[i][j]-65]++;
    }
    t=k[0];m=0;
    for(j=0;j<26;j++)
    {
        if(k[j]>t) {t=k[j];m=j;}
    }
    printf("%c\n%d\n",m+65,t);
    for(i=0;i<n;i++)
    {
        for(j=0;b[i][j];j++)
        {
            if(b[i][j]==m+65)
            {
                printf("%d\n",a[i]);
                break;
            }
        }
    }
    return 0;
}
void main()
{
	struct book{
		int num;
		char str[30];
	}bk[1000]={0};
	int i,j,m,n,sum[100]={0},number[1000]={0},result,max=0;
	char temp='A';
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d %s",&bk[i].num,&bk[i].str);
	for(i=65;i<=90;i++){
		for(j=0;j<m;j++){
			for(n=0;n<26;n++)
				if(bk[j].str[n]==i)
					sum[i]++;
		}
	}
	for(j=0;j<26;j++){
		if(sum[j+65]>max){
			max=sum[j+65];
			temp=j+65;
			result=j+65;
		}
	}
	for(i=0;i<m;i++){
		for(n=0;n<30;n++)
			if(bk[i].str[n]==temp){
				number[i]=bk[i].num;
				break;
			}
	}
	printf("%c\n%d\n",temp,sum[result]);
	for(i=0;i<m;i++)
		if(number[i]!=0)
			printf("%d\n",number[i]);
}
int main()
{
	struct fy{
		int x;
		char y[26];
		int s[26];
		struct fy *z;
	}sl[1000],*p;
	int n,i,j,b[26]={0};
	char a[100];
	p=&sl[0];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&sl[i].x,sl[i].y);
		for(j=0;j<strlen(sl[i].y);j++)
		{
			sl[i].s[sl[i].y[j]-'A']=1;
			b[sl[i].y[j]-'A']++;
		}
		sl[i].z=&sl[i+1];
	}
	sl[n-1].z=NULL;
	for(i=0;i<26;i++)
	{
		for(j=0;j<26;j++)
			if(b[i]<b[j])
				break;
		if(j==26)
		{
			j=i;
			break;
		}
	}
	printf("%c\n%d\n",i+'A',b[j]);
	while(p!=NULL)
	{
		if(p->s[i]==1)
			printf("%d\n",p->x);
		p=p->z;
	}
	return 0;
}
int main()
{
    int maxc=0,i,j,n,a[1000],c;
    char maxp,b[1000][27],p;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d%s",&a[i],b[i]);
    }
    for (p='A';p<='Z';p++)
    {
        c=0;
         for(i=0;i<n;i++)
         {
            for(j=0;;j++)
            {
                if(b[i][j]=='\0') break;
                if(b[i][j]==p)
                {
                    c++;
                }

            }
         }
        if(c>maxc)
        {
            maxc=c;
            maxp=p;
        }
    }
    printf("%c\n",maxp);
    printf("%d\n",maxc);




      for(i=0;i<n;i++)
         {
            for(j=0;;j++)
            {
                if(b[i][j]=='\0') break;
                if(b[i][j]==maxp)
                {
                    printf("%d\n",a[i]);
                }

            }
         }





    
    return 0;
}
struct book
{
	int no;
	char author[26];
}ji[1000];

main()
{
	int n,i,j,len,a[26][1000],e,b[26]={0},max=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&ji[i].no,ji[i].author);
		len=strlen(ji[i].author);
		for(j=0;j<len;j++)
		{
			e=ji[i].author[j];
			e=e-65;
			a[e][b[e]]=ji[i].no;
			b[e]=b[e]+1;
		}
	}
	for(i=0;i<26;i++)
		if(b[max]<b[i])
			max=i;
	printf("%c\n%d\n",max+65,b[max]);
	for(i=0;i<b[max];i++)
		printf("%d\n",a[max][i]);
	return 0;
}
int main()
{int m, i, j, b[999], n[26], t[2]={0}, x=0;
char a[999][26], au;
scanf("%d",&m);
for(i=0;i<m;i++)
{scanf("%d%s",&b[i],a[i]);}
for(i=0;i<m;i++)
{
	for(j=0;j<(int)strlen(a[i]);j++)
	{n[(int)a[i][j]-65]++;}
}
for(i=0;i<26;i++)
{
	if(t[0]<n[i])
	{t[0]=n[i],t[1]=i;}
}
au=t[1]+65;
printf("%c\n%d\n",au,t[0]);
for(i=0;i<m;i++)
{
	x=0,j=0;
	while(j<(int)strlen(a[i])&&x==0)
	{
		if(a[i][j]==t[1]+65)
		{printf("%d\n",b[i]),x++;}
		else
		{j++;}
	}
}
return 0;
}
struct A
{
	char num[1000];
	char B[27];
};
void main()
{
	int n,i,a,k,t;
	int sb[27]={0};
	int sb2[27]={0};
	char x;

	scanf("%d",&n);

	struct A book[999]={0};
	for (i=0;i<n;i++)
	{
		scanf("%s%s",book[i].num,book[i].B);
	}
	for(i=0;i<n;i++)
	{
		for(k=0; ;k++)
		{
			a=book[i].B[k];
			if (book[i].B[k]<='Z'&&book[i].B[k]>='A')
			{
			sb[a-64]++;
			}
			else break;
		}
	}
	for(i=1;i<=26;i++)
	{
		sb2[i]=sb[i];
	}
	for (i=1;i<26;i++)
	{
		if(sb[i]>sb[i+1])
		{
			a=sb[i];
			sb[i]=sb[i+1];
			sb[i+1]=a;
		}
	}

	for(i=1;i<=26;i++)
	{
		if (sb2[i]==sb[26])
		{
			t=i;
		}
	}
	x='A'+t-1;
	printf("%c\n%d\n",x,sb[26]);
	
	for(i=0;i<n;i++)
	{
		for(k=0; ;k++)
		{
			if(book[i].B[k]=='\0')break;

			else if (book[i].B[k]==x)
				printf("%s\n",book[i].num);
		}
	}
}
struct book
{
	int num;
	char auth[26];
	struct book *next;
};
struct book *creat(int m)
{
	int i=0;
	struct book *head,*p1,*p2;
	if(i==0)
	{
		p1=(struct book*)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->auth);
		head=p1;
		p2=p1;
		p1->next=NULL;
		i++;
	}
	while(i<m)
	{
		p1=(struct book*)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->auth);
		p2->next=p1;
		p1->next=NULL;
		p2=p1;
		i++;
	}
	return (head);
}

int main()
{
	int m,i,lenth;
	int max=0,maxwh=27;
	int count[26]={0};
	struct book *head,*p;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	while(p!=NULL)
	{
		lenth=strlen(p->auth);
		for(i=0;i<lenth;i++)
			count[(int)(p->auth)[i]-65]++;
		p=p->next;
	}
	for(i=0;i<26;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			maxwh=i;
		}
	}
	printf("%c\n",maxwh+65);
	printf("%d\n",max);
	p=head;
	while(p!=NULL)
	{
		lenth=strlen(p->auth);
		for(i=0;i<lenth;i++)
		{
			if((int)(p->auth[i])==maxwh+65)
			{
				printf("%d\n",p->num);
				break;
			}
		}
		p=p->next;
	}
	return 0;
}
int main()
{
	int i,j,k,n,num[1000],len[1000],num1[1000][26]={0},sum[26]={0},max=0,m;
	char writer[1000][26],letter[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",&num[i],writer[i]);
        len[i]=strlen(writer[i]);
	}
	for(i=0;i<26;i++)
	{
		for(j=0;j<n;j++)
		{
			for(k=0;k<len[j];k++)
			{
				if(writer[j][k]==letter[i])
				{
					num1[j][i]++;
				}
			}
		}
	}
	for(i=0;i<26;i++)
	{
		for(j=0;j<n;j++)
		{
	       sum[i]=sum[i]+num1[j][i]; 
		}	
	}
	for(i=0;i<26;i++)
	{
		if(max<sum[i])
		{
			max=sum[i];
			m=i;
		}
	}
	printf("%c\n%d\n",letter[m],sum[m]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			if(writer[i][j]==letter[m])
			{
				printf("%d\n",num[i]);
			}
		}
	}
	return 0;
}
int n;
struct student
{
	char name[100];
	int num;
	struct student *next;
};

struct student *creat(void)
{
	struct student *head;
    struct student *p1,*p2;
    int i;
	p1=p2=(struct student*)malloc(LEN);
	head=p1;
	for(i=0;i<n;i++)
	{p1=(struct student*)malloc(LEN);
	p2->next=p1;
	p2=p1;
	scanf("%d %s",&p1->num,p1->name);
	}
	p2->next=NULL;
	return(head);
}

void list(struct student *head)
{
	struct student *p1,*p2,*p3,*p4;
	int i,j,t,a[100]={0},b[100];
	char str[100];
    p1=head->next;
	for(i=0;i<n;i++)
	{
		strcpy(str,p1->name);
		for(j=0;j<strlen(str);j++)           //?????2?????i????
		{if(str[j]>='A'&&str[j]<='Z'){a[str[j]-65]++;}  //?????????a[]????
		}
		p1=p1->next;
	}
		for(i=0;i<26;i++){b[i]=a[i];}
		for(i=0;i<26-1;i++)
		{for(j=0;j<26-1-i;j++)
		{if(a[j]<a[j+1]){t=a[j];a[j]=a[j+1];a[j+1]=t;} //????
		}
		}
		for(i=0;i<26;i++)
		{if(b[i]==a[0]) {printf("%c\n%d\n",i+65,a[0]);t=i;}  //b[i]?=a[0]????????,??????
		}
	p1=head->next;                         //??8??????????????????????????????????????????????
     for(i=0;i<n;i++)
	{
		strcpy(str,p1->name);
		for(j=0;j<strlen(str);j++)           
		{if(str[j]==t+65){printf("%d\n",p1->num);}  
		}
		p1=p1->next;
	}
	}

int main()
{  struct student *p;
   scanf("%d",&n);
   p=creat();
   list(p);
}
  
//???????????????????????str?????????A-Z??????a[0]-a[25]????a[]????b[],b[]?????????????????a[]?
//?b[]??a[0](?????)????????????????????
//????????????????????? ????????????
struct stu{
	int id;
	char author[26];
	int length;
}a[1000];

int main(){
	int n,i,k,num=0,max=0;
	char b,c;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%s",&a[i].id,a[i].author);
		a[i].length=strlen(a[i].author);
	}
	for(b='A';b<='Z';b++){
		num=0;
		for(i=0;i<n;i++){
			for(k=0;k<a[i].length;k++){
				if(a[i].author[k]==b){
					num++;
					break;
				}
			}
		}
		if(num>max){
			max=num;
			c=b;
		}
	}
	printf("%c\n%d\n",c,max);
	for(i=0;i<n;i++){
		for(k=0;k<a[i].length;k++){
			if(a[i].author[k]==c){
					printf("%d\n",a[i].id);
					break;
			}
		}
	}
	return 0;
}
struct stu{
	int num;
	char id[26];
}a[999];

struct aut{
	char wri;
	int sum;
}b[26];

int main(){
	int n,i,j,k,t,m=0;
	for(i=0;i<26;i++){
		b[i].wri='A'+i;
		b[i].sum=0;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i].num);
		scanf("%s",a[i].id);
	}

    for(j=0;j<26;j++){
		for(i=0;i<n;i++){
			for(k=0;k<26;k++){
				if(b[j].wri==a[i].id[k]){
					b[j].sum++;
				}
			}
		}
	}
	int max=b[0].sum;
	for(j=0;j<26;j++){
		if(max<b[j].sum){
			max=b[j].sum;
			m=j;
		}
	}
	printf("%c\n%d\n",b[m].wri,max);
    for(i=0;i<n;i++){
         for(k=0;k<26;k++){
			 if(a[i].id[k]==b[m].wri)
				 printf("%d\n",a[i].num);
		 }
	}

	
	return 0;
}
struct info
{
	int nam;
	char aut[27];
}inf[1000];
void main()
{
	int n,i,a[26]={0},k,max=0,sum=0;
	char *p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%s",&inf[i].nam,inf[i].aut);
	for(i=0;i<n;i++)
	{
		p=inf[i].aut;
		while(*p!='\0')
		{
			a[*p-65]++;
			p++;
		}
	}
	for(i=0;i<26;i++)
		max=max>a[i]?max:a[i];
	for(i=0;i<26;i++)
	{if(a[i]==max){printf("%c\n",i+65);break;}}
	k=i+65;
	for(i=0;i<n;i++)
	{
		p=inf[i].aut;
		while(*p!='\0')
		{if(*p==k){sum++;break;}p++;}
	}printf("%d\n",sum);
	for(i=0;i<n;i++)
	{
		p=inf[i].aut;
		while(*p!='\0')
		{if(*p==k){printf("%d\n",inf[i].nam);break;}
		p++;
		}
	}
}
int main()
{
	int m;
	struct bo
	{int a;
	char au[36];
	};
	struct bo bo[999];
	int i,j;
	char k,K;
	int sb[26]={0},sbt;
	int len;
	int n;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d %s",&bo[i].a,bo[i].au);
		len=strlen(bo[i].au);
		for(j=0;j<len;j++){
			for(k=65;k<91;k++){
				if(bo[i].au[j]==k){
					sb[k-65]++;
				}
			}
		}
	}
	K=0;
	sbt=0;
	for(i=0;i<26;i++){
		if(sb[i]>sbt){
			K=i+65;
			sbt=sb[i];
		}
	}
	printf("%c\n%d\n",K,sbt);
	for(i=0;i<m;i++){
		n=1;
		for(j=0;j<strlen(bo[i].au);j++){
			if(K==bo[i].au[j]){
				n=0;
			}
		}
		if(n==0){
			printf("%d\n",bo[i].a);
		}
	}
	


}
int m,n;
struct student
{
	int id;
    char name[100];
	struct student* next;
};
struct student *creat()
{
	int i=1;
	struct student *head,*p1,*p2;
	p1=p2=(struct student*)malloc(len);
	scanf("%d",&m);
	scanf("%d %s",&p1->id,p1->name);
	head=NULL;
	for(;i<m;i++)
	{
		if(i==1) head=p1;
		p1=(struct student*)malloc(len);
		scanf("%d %s",&p1->id,p1->name);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return(head);
}

void main()
{
	struct student *head,*p1;
	int num[30]={0},max,j;
	char i,auth;
	head=creat();

	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(i='A';i<='Z';i++)
		{
			for(j=0;j<strlen(p1->name);j++)
				if(p1->name[j]==i)
				num[i-'A']++;
		}
	}
	for(i=0,max=0;i<26;i++)
	{
		if(num[i]>max) 
		{
			max=num[i];
			auth=i+'A';
		}
	}
	printf("%c\n",auth);
	printf("%d\n",max);
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(j=0;j<strlen(p1->name);j++)
			if(p1->name[j]==auth)
			printf("%d\n",p1->id);
	}
}
int main()
{
 int i,j,k,l,m,n,g[26]={0},s[26][1000]={0};
 char a[50];
 scanf("%d",&n);
 for(m=0;m<n;m++)
 {for(i=0;i<50;i++)
   a[i]=0;
  scanf("%d%s",&l,a);
  for(i=0;i<26;i++)
   for(j=0;j<26;j++)  
    if(a[i]=='A'+j) 
    {s[j][g[j]]=l,g[j]++;
     break;}}
 m=0;
 for(i=0;i<26;i++)
  if(g[i]>m) m=g[i],k=i;
 printf("%c\n%d\n",'A'+k,m);
 for(i=0;i<m;i++)
  printf("%d\n",s[k][i]);

}
struct m
{ int no,j;
  char a[27];

}
main()
{ int n,k,i,j,no,ath[26]={0},m;
  char *t,a[26];
  struct m *head,*p1,*p2,*tp,*q;
  scanf("%d",&n);
  head=(struct m*)calloc(n,L);
  for(i=0;i<n;i++)
  { scanf("%d%s",&(head+i)->no,(head+i)->a);
    (head+i)->j=0;
    for(t=(head+i)->a;*t!='\0';t++)
    {
     ath[*t-'A']++;
    }
  }
  for(m=ath[0],k=0,i=1;i<26;i++)
  {  if(ath[i]>m){k=i;m=ath[i];}
  }
  printf("%c",'A'+k);
  m=0;
  for(i=0;i<n;i++)
  { for(t=(head+i)->a;*t!='\0';t++)
     if(*t==('A'+k))
     { (head+i)->j=1;
       m++;
       break;
     }
  }
  printf("\n%d\n",m);
  for(i=0;i<n;i++)
  {  if((head+i)->j==1){
       printf("%d",(head+i)->no);
     m--;
     if(m>0)printf("\n");}
  }
}
int main()
{
	struct book
	{
		int num;
		char writer[26];
	}bookn[999];
	struct zuozhe
	{
		char w;
		int count;
	}zuozhen[26];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<26;i++)
	{
		zuozhen[i].w='A'+i;
		zuozhen[i].count=0;
	}
	int h=0;
	int m,j;
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&bookn[i].num,bookn[i].writer);
		m=strlen(bookn[i].writer);
		for(j=0;j<m;j++)
		{
			h=bookn[i].writer[j]-'A';
			zuozhen[h].count++;
		}
	}
	struct zuozhe a;
	a=zuozhen[0];
	for(i=1;i<26;i++)
	{
		if(a.count<zuozhen[i].count)
			a=zuozhen[i];
	}
	printf("%c\n",a.w);
	printf("%d\n",a.count);
	int t;
	for(i=0;i<n;i++)
	{
		t=strlen(bookn[i].writer);
		for(j=0;j<t;j++)
		{
			if(bookn[i].writer[j]==a.w)
				printf("%d\n",bookn[i].num);
		}
	}
}
void main()
{
    
	int a[1000];
	char s[1000][30],ch;
	int b[30]={0};
	int i,k;
	int n;
    int max=0;
    
	scanf("%d",&n);
	for(i=0;i<n;i++)
			scanf("%d %s",&a[i],s[i]);
	for(i=0;i<n;i++)
		for(ch='A';ch<='Z';ch++)
			if(strchr(s[i],ch)!=NULL)
				b[ch-65]++;


    for(i=0;i<=26;i++)
		if(b[i]>max)
		{
			max=b[i];
			k=i;
		}
		printf("%c\n%d\n",k+65,max);
		ch=k+65;
    for(i=0;i<n;i++)
           if(strchr(s[i],ch)!=NULL)
			   printf("%d\n",a[i]);
		   
    
	
}
void main()
{
	int n,i,j,sh[100],a[26]={0},b[26][100];
	int max,t,m;
	char ch[100][40]={'\0'};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&sh[i],ch[i]);
	}
	for(i=0;i<n;i++)
	{
		
		for(j=0;j<40;j++)
		{
			m=ch[i][j];
			if(m>64 && m<91)
			{a[m-65]++;b[m-65][a[m-65]]=sh[i];}
	}}
	max=0;
	for(i=0;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];t=i;
		}
	}
	printf("%c\n",65+t);
	printf("%d\n",a[t]);
	for(i=1;i<=a[t];i++)
	{
		printf("%d\n",b[t][i]);
	}
}
int main()
{
	int n;
	scanf("%d",&n);
	int a[1000]={0},b[1000]={0},c[100]={0},l=0;
	char s[1000][100]={0},m[26]={0},p;
	int i=0,j=0,k=0,t=0;
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&a[i],s[i]);
	}
	for(i='A';i<='Z';i++)
	{
		m[j]=i;
		for(t=0;t<n;t++)
		{
			for(k=0;s[t][k]!='\0';k++)
			{
				if(s[t][k]==m[j])
				{
				  c[j]++;
				  break;
				}
			}
		}
		j++;
	}
	l=0;
	for(i=0;i<26;i++)
	{
		if(c[i]>l)
		{
			l=c[i];
			p=m[i];
		}
	}
	printf("%c\n",p);
	printf("%d\n",l);
	for(i=0;i<n;i++)
	{
		k=0;
		for(j=0;s[i][j]!='\0';j++)
		{
			if(s[i][j]==p)
			{
				k=1;
				break;
			}
		}
		if(k==1)
		{
			printf("%d\n",a[i]);
		}
	}
	return 0;
}
int main()
{
	char a[1000][27],x;
	int m,i,j,k,b[1000],c[26]={0},max=0;
	cin>>m;
	for(i=0;i<m;i++)
	{
		cin>>b[i]>>a[i];
		int len=strlen(a[i]);
		for(j=0;j<len;j++)
			c[a[i][j]-'A']++;
	}
	for(j=0;j<26;j++)
		if(max<c[j])
		{
			max=c[j];
		    x='A'+j;
		}

	cout<<x<<endl;
	cout<<max<<endl;
    for(i=0;i<m;i++)
	{
		int len=strlen(a[i]);
		for(k=0;k<len;k++)
			if(a[i][k]==x)
			{
				cout<<b[i]<<endl;
				break;
			}
	}

return 0;
}
int a[26][1000];
int ai[26];
void func()
{
    int k,i,len;
    char str[27];
    scanf("%d %s",&k,str);
    len=strlen(str);
    for(i=0;i<len;i++)
    {
        a[str[i]-'A'][ai[str[i]-'A']]=k;
        ai[str[i]-'A']++;
    }
}
int main()
{
    memset(a,0,sizeof(a));
    memset(ai,0,sizeof(ai));
    int n,i,i0,max=0;
    scanf("%d",&n);
    while(n--)
    func();
    for(i=0;i<26;i++)
    {
        if(ai[i]>max)
        {max=ai[i];
        i0=i;}
    }
    printf("%c\n",i0+'A');
    printf("%d\n",max);
    for(i=0;i<ai[i0];i++)
    printf("%d\n",a[i0][i]);
}
struct book
{
	int id;
	char s[L];
	int len;
}b[M];
void fun(int count[L],char s[L],int len)
{
	int i;
	for(i=0;i<len;i++)
	{
		int m;
		m=s[i]-'A';
		count[m]++;
	}
}
int judge(char s[L],int len,char name)
{
	int i,answer=0;
	for(i=0;i<len;i++)
	{
		if(s[i]==name)
		{
			answer=1;
			break;
		}
	}
	return answer;
}

int main()
{
	int m,k,count[L]={0},i,j,max,num;
	char name;
	scanf("%d",&m);
	for(k=0;k<m;k++)
	{
		scanf("%d%s",&b[k].id,b[k].s);
		b[k].len=strlen(b[k].s);
		fun(count,b[k].s,b[k].len);
	}
	max=count[0];
	num=0;
	for(j=1;j<L;j++)
	{
		if(count[j]>max)
		{
			max=count[j];
			num=j;
		}
	}
	name=num+65;
	printf("%c\n",name);
	printf("%d\n",max);
	for(k=0;k<m;k++)
	{
		int answer=0;
		answer=judge(b[k].s,b[k].len,name);
			if(answer==1)
				printf("%d\n",b[k].id);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int m,i,j,len,max;
	int id[1000],b[26]={0};
	char a[100][27],name;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d %s",&id[i],a[i]);
		len=strlen(a[i]);
        for(j=0;j<len;j++){
			b[a[i][j]-'A']++;
		}
	}//??????????????????????????
	max=b[0];name='A';
	for(j=1;j<26;j++){
		if(b[j]>max){
		max=b[j];
		name=j+'A';
		}
	}
	printf("%c\n%d\n",name,max);//????????????????
	for(i=0;i<m;i++){
		len=strlen(a[i]);
		for(j=0;j<len;j++){
		if(a[i][j]==name)
		{strcpy(a[i],"shuchu");
		break;}//????????????
		}
	}
	for(i=0;i<m;i++){
	if(strcmp(a[i],"shuchu")==0)
		printf("%d\n",id[i]);//???????????
	}


	return 0;
}
struct Bo{
	int num;
	char auth[30];
}a[1010];


void main(){
	int n,i,j,maxnum=0,max;
	int zuozhe[26]={0};
	char out;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d %s",&a[i].num,a[i].auth);
		for(j=0;j<=strlen(a[i].auth)-1;j++)
			zuozhe[a[i].auth[j]-'A']=zuozhe[a[i].auth[j]-'A']+1;
	}
	for(i=1;i<=25;i++)
		if(zuozhe[i]>zuozhe[maxnum]) maxnum=i;
	out='A'+maxnum;
	printf("%c\n",out);
	printf("%d\n",zuozhe[maxnum]);

	for(i=1;i<=n;i++)
	{
		if(strchr(a[i].auth,out)!=NULL) printf("%d\n",a[i].num);
	}
}
int main()
{
	struct bookinf
	{
		int code;
		char auth[27];
	}book[999];
	int i,k,m,max=0,num[26];
	for (i=0;i<26;i++)
		num[i]=0;
	scanf("%d", &m);
	for (i=0;i<m;i++)
	{
		scanf ("%d %s", &book[i].code, book[i].auth);
		for (k=0;book[i].auth[k]!='\0';k++)
				num[book[i].auth[k]-'A']+=1;
	}
	for (i=1;i<26;i++)
	{
		if (num[i]>num[max])
			max=i;
	}
	printf("%c\n%d\n", max+'A', num[max]);
	for (i=0;i<m;i++)
	{
		for (k=0;book[i].auth[k]!='\0';k++)
		{
			if (book[i].auth[k]==max+'A')
			{
				printf("%d\n", book[i].code);
				break;
			}
		}
	}
	return 0;
}
struct
{
	int a;
	char b[26];
}shu[1000];

int main()
{
	int s[27];
	int n,i,j,o,max,t=1,x;
	scanf("%d",&n);
	for (i=0;i<n;i++)
		scanf("%d %s",&shu[i].a,shu[i].b);

	for (i=1;i<=26;i++)
		s[i]=0;

	for (i=0;i<n;i++)
		for (j=0;j<strlen(shu[i].b);j++)
		{
			o=shu[i].b[j]-64;
			s[o]++;
		}


	max=0;
	for(i=1;i<=26;i++)
		if (max<s[i]) {max=s[i];t=i;}
	printf("%c\n",t+64);
	printf("%d\n",max);

	for (i=0;i<n;i++)
	{
		x=strlen(shu[i].b);
		for (j=0;j<x;j++)
			if (shu[i].b[j]==t+64)
				printf("%d\n",shu[i].a);
	}
	return 0;


	
}
int main()
{
	int m, a, i, j, k, n, s[26][999] = {0}, p[26] = {0};
	char b[26], c;
	cin >> m;
	for(i = 0; i < m; i++)
	{
		cin >> j;
		cin >> b;
		n = strlen(b);
		for(k = 0; k < n; k++)
		{
			a = b[k] - 'A';
			s[a][p[a]] = j;
			p[a] ++;
		}
	}
	j = 0;
	for(i = 1; i < 26; i++)
	{
		if(p[j] < p[i])
			j = i;
	}
	c = 'A' + j;
	cout << c << endl << p[j] << endl;
	for(i = 0; ; i++)
	{
		if(s[j][i] != 0)
			cout << s[j][i] << endl;
		else break;
	}
	return 0;
}