semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int n,i,l,x,maxnumber;
    scanf("%d",&n);
    int a[1000];
    char k[1000][30]; 
    int author[27]={0};
    for(i=1;i<=n;i++)
    {
                      scanf("%d %s",&a[i],k[i]);
                      int m;
                      m=strlen(k[i]);
                      for(l=0;l<30;l++)
                      {
                                        for(x=1;x<=26;x++)
                                        {
                                                          if(k[i][l]==x+64)
                                                          author[x]++;
                                        }
                      }
    }
    int max=0;
    for(i=1;i<=26;i++)
    {
                      if(author[i]>max)
                      max=author[i];
    } 
    for(i=1;i<=26;i++)
    {
                      if(author[i]==max)
                      maxnumber=i;
    } 
    char who[10];
    who[0]='A'+maxnumber-1 ;
    printf("%c\n",who[0]);
    printf("%d\n",max);
    for(i=1;i<=n;i++)
    {
                     for(l=0;l<=strlen(k[i]);l++)
                     if(k[i][l]==who[0])
                     printf("%d\n",a[i]);
    }
    return 0; 
}
struct book
{
 int a;
 char b[30];
 struct book *next;
};
void main()
{
 int i,k,m,max=0,t;
 char j,ch;
 struct book *head,*p1,*p2;
 scanf("%d",&m);
 p1=(struct book*)calloc(1,sizeof(struct book));
 head=p1;
 for(i=0;i<m;i++)
 {
  scanf("%d %s",&(p1->a),p1->b);
  p2=p1;
  if(i==m-1)
   p2->next=NULL;
  else
  {
   p1=(struct book*)calloc(1,sizeof(struct book));
   p2->next=p1;
  }
 }
 for(j='A';j<='Z';j++)
 {
 t=0;
 p1=head;
 while(p1)
 {
  for(k=0;k<strlen(p1->b);k++)
   if((p1->b)[k]==j)
	t++;
  p1=p1->next;
 }
 if(t>max)
 {
  max=t;
  ch=j;
 }
 }
 printf("%c\n",ch);
 printf("%d\n",max);
 p1=head;
 while(p1)
 {
  for(k=0;k<strlen(p1->b);k++)
   if((p1->b)[k]==ch)
	printf("%d\n",p1->a);
  p1=p1->next;
 } 
}
struct books{
	int num;
	char writer[26];
	struct books *next;
};

int m;

struct books *creat()
{
	struct books *head,*p1,*p2;
	int i;
	p2=p1=(struct books*)malloc(sizeof(struct books));
	for (i=1;i<=m;i++){
		if (i==1) head=p1;
		scanf("%d %s",&p1->num,p1->writer);
		p2=p1;
		if(i!=m){
			p1=(struct books*)malloc(sizeof(struct books));
			p2->next=p1;
		}
		else p2->next=NULL;
	}
	return head;
}

void main()
{
	int character[26];
	struct books *head,*p;
	int i,max=0,imax;
	for (i=0;i<26;i++) character[i]=0;
	scanf("%d",&m);
	head=creat();
	p=head;
	while(1){
		i=0;
		while(*(p->writer+i)){
			character[*(p->writer+i)-'A']++;
			i++;		
		}
		p=p->next;
		if(p==NULL) break;
	}
	
	for (i=0;i<26;i++){
		if (character[i]>max){
			max=character[i];
			imax=i;
		}
	}

	printf("%c\n%d\n",imax+'A',max);

	p=head;
	while(1){
		i=0;
		while(*(p->writer+i)){
			if(*(p->writer+i)==imax+'A'){
				printf("%d\n",p->num);
				break;
			}
			i++;		
		}
		p=p->next;
		if(p==NULL) break;
	}
}
struct book{
	int num;
	char s[27];
}shu[1000];
int main(){
	int n,i,l,j,max;
	char name;
	int letter[26]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%s",&shu[i].num,&shu[i].s);
		l=strlen(shu[i].s);
		for(j=0;j<l;j++){
			letter[(shu[i].s[j]-65)]++;
		}
	}
	for(max=letter[0],name=65,i=1;i<26;i++){
		if(letter[i]>max){
			max=letter[i];
			name=i+65;
		}
	}
	printf("%c\n%d\n",name,max);
	for(i=0;i<n;i++){
		l=strlen(shu[i].s);
		for(j=0;j<l;j++){
			if(shu[i].s[j]==name){
				printf("%d\n",shu[i].num);
			}
		}
	}
	return 0;
}
int w[26]={0};//zimu 0 26
int p=0;
void zimu(char a[]){
	int m,i,j;
	char c;
	m=strlen(a);
	for(j=0;j<26;j++){
		c='A'+j;

		for(i=0;i<m;i++){
		if(a[i]==c)
			w[j]++;
	}

	}//for1 end
}
int max(int w[26]){
	int i,max;
	max=w[0];
	for(i=1;i<26;i++)
		if(w[i]>max){
			max=w[i];
			p=i;
		
		}
			return max;
}

void main(){
	char b[300][20];
	int a[300];
	int m,i,j,mm;
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d%s",&a[i],b[i]);
	for(i=0;i<m;i++)
		zimu(b[i]);
	mm=max(w);

printf("%c\n",p+'A');
printf("%d\n",mm);
for(i=0;i<m;i++){
	for(j=0;j<(strlen(b[i]));j++)
		if(b[i][j]==(p+'A')){
			printf("%d\n",a[i]);
			break;
		}
}

}
struct author
 { int num;
   char name[26];
   
 }; 
 struct author ren[100];
 
 int main()
 { int n,i,j=0,k=0,biao,maxzuozhe,p,geshu[26]={0},max=0,maxdeshu[999];
 
   scanf("%d\n",&n);
   for(i=0;i<=n-1;i++)
   { scanf("%d",&ren[i].num);
    scanf("%s",ren[i].name);
   }
   
   for(i=0;i<=25;i++)
   { for(j=0;j<=n-1;j++)
      {
            for(k=0;k<=strlen(ren[j].name);k++)
            { if((i+'A')==ren[j].name[k])
              geshu[i]=geshu[i]+1;
              }
      } 
    }
       for(i='A'-65;i<='Z'-65;i++)
   { if(max<geshu[i])
     {max=geshu[i];
      biao=i;}
    }
    maxzuozhe='A'+biao;
    p=0;
    for(i=0;i<=n-1;i++)
    { for(k=0;k<=strlen(ren[i].name);k++)
      { if(maxzuozhe==ren[i].name[k])
        {maxdeshu[p]=ren[i].num;
         p++;
         break;}
      }
    }
    printf("%c\n",maxzuozhe);
    printf("%d\n",p);
    for(i=0;i<=p-1;i++)
    printf("%d\n",maxdeshu[i]);

    getchar();
    
}
int main()
{
	int n,book[1000],i,j,countt[26]={0},len,max=-1, maxauthor;
	char peo[1000][27],sum[100000]="\0",ch;
	cin >> n;
	for(i=1;i<=n;i++)
	{
		cin >> book[i] >> peo[i];
		strcat(sum,peo[i]);
	}
	len=strlen(sum);
	for(i=0;i<len;i++)
		countt[sum[i]-65]++;
	for(i=0;i<26;i++)
		if(countt[i]>max)
		{
			max=countt[i];
			maxauthor = i;
		}

	ch=maxauthor+65;
	int p=0,t=0;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<strlen(peo[i]);j++)
			if(peo[i][j]==ch)
				p++;
		if(p>0)
			book[i-t]=book[i];
		else
			t++;
		p=0;
	}
	cout << ch << endl;
	cout << n-t << endl;
	for(i=1;i<=n-t;i++)
		cout << book[i] << endl;
	return 0;
}
struct{
	int location[1001];
	int num;
	int sum;
}ans[27];
int main()
{
	int n,value=-1,order,m;
	char s[28];
	cin>>n;
	for(int i=1;i<=26;i++)
	{
		ans[i].num=ans[i].sum=0;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>m;
		cin>>s;
		for(int j=0;j<strlen(s);j++)
		{
			ans[s[j]-'A'+1].num++;
			ans[s[j]-'A'+1].sum++;
			ans[s[j]-'A'+1].location[ans[s[j]-'A'+1].num]=m;
		}
	}
	for(int i=1;i<=26;i++)
	if(ans[i].sum>value)
	{
		value=ans[i].sum;
		order=i;
	}
	cout<<(char)(order+'A'-1)<<endl;
	cout<<ans[order].num<<endl;
	for(int i=1;i<=ans[order].num;i++)
		cout<<ans[order].location[i]<<endl;
		return 0;
}
struct sa
{
	int a;
	char b[100];
	struct sa *next;
};
int n,m,k[27];
struct sa *kao(void)
{
	struct sa *head;
	struct sa *p1,*p2;
	n=0;
    head=NULL;
	p1=p2=(struct sa *)malloc(len);
	scanf("%d %s",&p1->a,p1->b);
	head=p1;
    for(;;)
	{
       n++;
	   if(n==m+1)
		   break;
	   if(n==1)
		   head=p1;
	   else
	   {
		   p2=p1;
           p1=(struct sa *)malloc(len);
		   scanf("%d %s",&p1->a,p1->b);
		   p2->next=p1;
	   }
	}
	p1->next=NULL;
	return (head);
}
int main()
{
	struct sa *p,*q,*head,*ped;
	int f,i,g,s=1,t,d=0;
	char c;
	scanf("%d",&m);
	head=kao();
	for(p=head;p!=NULL;p=p->next)
	{
        g=strlen(p->b);
		for(i=0;i<g;i++)
		{
			k[p->b[i]-64]++;
		}
	}
	t=k[1];
	for(i=2;i<27;i++)
	{
		if(k[i]>k[s])
		{s=i;t=k[i];}
	}
	printf("%c\n%d\n",s+64,t);
	for(p=head;p!=NULL;)
	{
		g=strlen(p->b);
		for(i=0;i<g;i++)
		{
			if(p->b[i]==s+64)
			{
				d=1;break;
			}
		}
		if(d==1)
			printf("%d\n",p->a);
		d=0;
		p=p->next;
	}
	return 0;
}
void main()
{
	struct book
	{
		int num;
		char auth[26];
		int inf[26];
		struct book *next;
	};
	struct book *head,*p1,*p2,*t1,*t2;
	head=(struct book *)malloc(sizeof(struct book));

	int m,i,k,l,j,max;
	int authnum[26]={0};
	scanf("%d",&m);
	p1=head;
	p2=p1;
	for (i=0;i<(m-1);i++)
	{
		scanf("%d %s",&(p1->num),p1->auth);
		p2=(struct book *)malloc(sizeof(struct book));
		p1->next=p2;
		p1=p2;
	}
	scanf("%d %s",&(p1->num),p1->auth);
	p2=NULL;
	p1->next=p2;
	
	p1=head;
	p2=p1;
	while(p1!=NULL)
	{
		l=strlen(p1->auth);
		for(j=0;j<l;j++)
		{
			p1->inf[(*((p1->auth)+j))-65]=1;
			authnum[(*((p1->auth)+j))-65]++;
		}
		p2=p1->next;
		p1=p2;
	}
	max=0;
	for(i=1;i<26;i++)
	{
		if (authnum[i]>authnum[max]) max=i;
	}
	printf("%c\n",(max+65));
	printf("%d\n",authnum[max]);

	p1=head;
	p2=p1;
	while(p1!=NULL)
	{
		if ((p1->inf[max])>0)
			printf("%d\n",p1->num);
		p2=p1->next;
		p1=p2;
	}
	p1=head;
	p2=p1;
	while(p1!=NULL)
	{
		p2=p1->next;
		free(p1);
		p1=p2;
	}
}
struct book{
	int name;
	char writer[100];
	struct book *next;
};

int a[26];

struct book *creat(int n)
{
	struct book *p1,*p2,*xhead;
	p1=(struct book*)malloc(len);
	scanf("%d %s",&p1->name,p1->writer);
	p2=p1;
	xhead=p1;

	while(n-1)
	{
		n--;
		p1=(struct book *)malloc(len);
		scanf("%d %s",&p1->name,p1->writer);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return xhead;
}


void find(struct book*head)
{
	struct book *p;
	int i;
	char s[100];
	p=head;
	while(p)
	{
		i=0;
		strcpy(s,p->writer);
		while(s[i]!='\0')
		{a[s[i]-'A']++;
		    i++;
		}

		p=p->next;
	}
}
		

void print(struct book *head,int max)
{
	struct book *p;
	p=head;
	while(p)
	{
		if(strchr(p->writer,max+'A')) printf("%d\n",p->name);
		p=p->next;
	}
}
	



void main()
{
	int i,max=0,n;
	struct book *head;
	memset(a,0,sizeof(a));
	scanf("%d",&n);
	head=creat(n);
	find (head);
	for(i=0;i<26;i++)
		if(a[i]>a[max]) max=i;
	printf("%c\n",max+'A');
	printf("%d\n",a[max]);
	print(head,max);
}
main()
{
   int m,n,j,k,id[1001],a[26]={0};
   char c[1001][26],b[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(j=1;j<=n;j++) {scanf("%d %s",&id[j],&c[j]);}
   for(m=0;m<26;m++)
   {
             for(j=1;j<=n;j++)
             {
                           for(k=0;k<26;k++) {if(b[m]==c[j][k]) a[m]=a[m]+1;}
             }
   }
   int t=0,r=0;
   for(m=0;m<=25;m++)
   {
        if(t<a[m]) {t=a[m];r=m;}
   }
   printf("%c\n%d",b[r],a[r]);
   for(j=1;j<=n;j++)
   {
             for(k=0;k<26;k++)
             {
                    if(c[j][k]==b[r]) printf("\n%d",id[j]);
             }
   }
}
void main()
{
	int i,j,k,n,m,sum=0,min,max,ID[1000]={0},a[26]={0};
	char name[1000][26]={""};
    scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d %s",&ID[i],&name[i]);

	for(i=0;i<n;i++)
		for(j=0;j<strlen(name[i]);j++)
           a[name[i][j]-'A']++;

   max=a[0];
   k=0;
   for(i=0;i<26;i++)
	   if(a[i]>max){max=a[i];k=i;}
   
   printf("%c\n%d\n",k+'A',a[k]);

   for(i=0;i<n;i++)
	   for(j=0;j<strlen(name[i]);j++)
		   if(name[i][j]=='A'+k)
			   printf("%d\n",ID[i]);


	

}
void main()
{
   int num=0,n,a[26],name[1000],name2[1000],i,j,k,max=0,maxi=0;
   char wr[1000][27];
   char q;
   scanf("%d",&n);
   for (i=0;i<26;i++)
   {
   	  a[i]=0;
   }
   for(i=0;i<n;i++)
   {
   	  scanf("%d%s",&(name[i]),wr[i]);
  	  for (j=0;j<26;j++)
   	  {
   	  	for (k=0;k<26;k++)
   	  	{
   	  	   if (wr[i][j]=='A'+k) a[k]++;
   	  	}
   	  }
   }
      for (i=0;i<26;i++)
      {
   	     if (a[i]>max)
   	     {
   	 	  max=a[i];
   	 	  maxi=i;
   	     }
      }
      q='A'+maxi;
      printf("%c\n",q);
      for (i=0;i<n;i++)
      {
   	    for (j=0;j<26;j++)
   	    {
   	   	if (wr[i][j]==q) 
   	   	{
            name2[num]=name[i];
            num++;
   	   	}
   	    }
      }
      printf("%d\n",num);
      for (i=0;i<num;i++) printf("%d\n",name2[i]);
   
}
int main ()
{
    int m;
    cin >> m;
    char writter[27];
    int data[26][1000];
    memset(data,0,sizeof(data));
    int max = 0;
    char max_name;
    for (int i = 1; i <= m; i++){
        int number;
        cin >> number >> writter;
        for (int j = 0; j < strlen(writter); j++){
            data[writter[j]-65][0]++;
            data[writter[j]-65][data[writter[j]-65][0]] = number;
            if (max < data[writter[j]-65][0]){
                max = data[writter[j]-65][0];
                max_name = writter[j];
            }
        }
    }
    cout << max_name << endl << max << endl;
    for (int i = 1; i <= max; i++)
        cout << data[max_name - 65][i] << endl;
    return 0;
}
struct book
{
	int num;
	char name[26];
}book[1000];
int judge(char*a,int b);
int main(int argc, char* argv[])
{
	char c;
	int n=0,i=0,j=0,rec[26]={0},k=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&book[i].num,book[i].name);
	}//????
	for(i=0;i<26;i++)//??i??????
	{
		for(j=0;j<n;j++)//??j?????
		{
			if(judge(book[j].name,i)==1)//???j????????i
			{rec[i]++;}//??i?????????rec[i]?????????
		}//??????????i??????????
	}//?????????26??????????????
	j=0;//j??????????????????
	k=rec[0];//k??????????????
	for(i=0;i<25;i++)
	{
		if(k<rec[i])
		{
			j=i;
			k=rec[i];
		}
	}
	c='A'+j;
	printf("%c\n%d\n",c,k);
	for(i=0;i<n;i++)
	{
		if(judge(book[i].name,j)==1)
		{printf("%d\n",book[i].num);}
	}
	return 0;
}
int judge(char*a,int b)
{
	int i=0;
	for(i=0;i<26;i++)
	{
		if(a[i]=='A'+b)
			return 1;
	}
	return 0;
}
struct stu
{
	int num;
	char c[26];
	struct stu*next;
};

struct stu*create(void)
{
	struct stu *p1,*p2,*head;
    int m;
	scanf("%d",&m);
	p1=(struct stu*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->c);
	p2=p1;
	head=p1;

	while(m-1)
	{
		m--;
		p1=(struct stu*)malloc(LEN);
		scanf("%d %s",&p1->num,p1->c);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return head;
}

void print(struct stu*head,int z)
{
	struct stu*q;
	int i,k;
	char s[20],s0[20]={'\0'};
	q=head;
	while(q)
	{
		strcpy(s,q->c);
		k=strlen(s);
		for(i=0;i<k;i++)
			if(s[i]==z+65)
			{
				printf("%d\n",q->num);
				break;
			}
		strcpy(s,s0);
		q=q->next;
	}
}

void main()
{
	int index;
	int a[26],k,t,i,max=0;
	char s[20],s0[20]={'\0'};
	struct stu*p,*head;
	memset(a,0,sizeof(a));

	head=create();
	p=head;

	while(p)
	{
		strcpy(s,p->c);
		k=strlen(s);
		for(i=0;i<k;i++)
		{
			t=s[i]-65;
			a[t]++;
		}
		strcpy(s,s0);
		p=p->next;
	}

	for(i=0;i<26;i++)
		if(a[i]>max)
		{
			max=a[i];
			index=i;
		}
	printf("%c\n%d\n",index+65,max);
	print(head,index);
}
struct data
{
 int no;
 char au[10];
};
void main()
{
 struct data lib[1000];
 char x;
 int n,i,j,num[26]={0},l[1000],k,max;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&lib[i].no);
  scanf("%s",lib[i].au);
  l[i]=strlen(lib[i].au);
 }
 for(i=0;i<n;i++)
 {
  for(j=0;j<l[i];j++)
  {
   num[lib[i].au[j]-65]=num[lib[i].au[j]-65]+1;
  }
 }
 max=num[0];
 for(i=0;i<26;i++)
 {
  if(num[i]>max)
  {
   max=num[i];
   k=i;
  }
 }
 printf("%c\n",k+65);
 printf("%d\n",max);
 x=k+65;
 for(i=0;i<n;i++)
 {
  for(j=0;j<l[i];j++)
  {
   if(lib[i].au[j]==x)
   printf("%d\n",lib[i].no);
  }
 }
}
struct book
{
	int num;
	char au[30];
	struct book *next;
};
void main()
{
	int m;
	scanf("%d",&m);
	struct book *p1,*p2,*head;
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->au);
	p2=p1;
	head=p1;
	int n=1;
while(n<m)
{
	p1=(struct book*)malloc(LEN);
	scanf("%d %s",&p1->num,p1->au);
	p2->next=p1;
	p2=p1;
	n++;
}
p2->next=NULL;

char maxa;
char author;
char temp[30];
int an,maxn=0,i;
	struct book *p;

for(author='A';author<='Z';)
	{				
		p=head;
	an=0;
		while(p)
		{	
			strcpy(temp,p->au);

		
		for(i=0;(temp[i])!='\0';i++)
		{
		if(temp[i]==author){an++;break;}
		}
		p=p->next;
		}
if(an>maxn)
		{
		maxa=author;
		maxn=an;
}	
	author=author+1;
}
printf("%c\n%d",maxa,maxn);
p=head;
while(p)
{	
	strcpy(temp,p->au);
	for(i=0;(temp[i])!='\0';i++)
		{
		if(temp[i]==maxa)
		{	printf("\n");
			printf("%d",p->num);break;}
		}
	p=p->next;

}



}
struct tushu{
int bianhao;
char writer[27];
}book[1000];
void jishu(struct tushu *p1,int a[26],int b);
int max(int c[26]);
void shu(struct tushu *p2,int d,int e);

int main(){
	int n,i,m;
	int zimu[26];
	struct tushu *pointer;
	pointer=&book[0];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %s",&book[i].bianhao,&book[i].writer);
	}
	jishu(pointer,zimu,n);
	m=max(zimu);
	shu(pointer,m,n);
	return 0;
}
void jishu(struct tushu *p1,int a[26],int b){
	int j,k,diji;
	for(j=0;j<26;j++){
		a[j]=0;
	}
	for(j=0;j<b;j++){
		k=0;
		do{
			diji=(*(p1+j)).writer[k]-'A';
			a[diji]++;
			k++;
		}while((*(p1+j)).writer[k]!='\0');
	}
}
int max(int c[26]){
	int k,da,jieguo=0;
	da=c[0];
	for(k=1;k<26;k++){
		if(c[k]>da){
			da=c[k];
			jieguo=k;
		}
	}
	printf("%c\n%d\n",65+jieguo,da);
	return(jieguo);
}
void shu(struct tushu *p2,int d,int e){
	char ai=65+d;
	int x,y;
	for(x=0;x<e;x++){
		y=0;
		do{
			if((*(p2+x)).writer[y]==ai){
				printf("%d\n",(p2+x)->bianhao);
			}
			y++;
		}while((*(p2+x)).writer[y]!='\0');
	}	
}
struct book
{
	int num;
	char wr[26];
	struct book *next;
};
void main()
{
	int i,n,m=0,j,a,b,c;
	int s[100]={0};
	scanf("%d",&n);
	struct book *head,*p1,*p2,*p;
	p1=p2=(struct book *)malloc(LEN);
	scanf("%d %s",&p1->num,p1->wr);
	head=NULL;
	while(m!=n-1)
	{
		m=m+1;
		if(m==1) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->wr);
	}
	p2->next=p1;
	p2=p1;
	p2->next=NULL;
	p=head;
	do
	{
		b=strlen(p->wr);
		for(j=0;j<b;j++)
			s[p->wr[j]]++;
		p=p->next;
	}while(p!=NULL);

	a=s[65];
	c=65;
	for(i=66;i<91;i++)
		if(a<s[i])
		{
			a=s[i];
			c=i;
		}
	printf("%c\n%d\n",c,a);

	p=head;
	do
	{
		b=strlen(p->wr);
		for(j=0;j<b;j++)
			if(p->wr[j]==c)
				printf("%d\n",p->num);
		p=p->next;
	}while(p!=NULL);
}
int main()
{
	int m,i,j;
	scanf("%d",&m);

	struct Bookinfo
	{
		int number;
		char auther[27];
	};

	struct Bookinfo a[1000];
	for (i=0;i<m;i++)
		scanf("%d %s",&a[i].number,a[i].auther);

	struct Author
	{
		int count;
		int number[1000];
	};

	struct Author b[26];
	for(i=0;i<26;i++) b[i].count=0;
	int max,record;

	for (i=0;i<m;i++)
	{
		int k;
		k=strlen(a[i].auther);
		for (j=0;j<k;j++)
		{
			b[a[i].auther[j]-'A'].number[b[a[i].auther[j]-'A'].count]=a[i].number;
			b[a[i].auther[j]-'A'].count++;
		}
	}

	max=b[0].count;
	for (i=0;i<26;i++)
		if (b[i].count>=max) 
		{
			max=b[i].count;
			record=i;
		}
	printf("%c\n%d\n",record+'A',max);
	for (i=0;i<max;i++)
		printf("%d\n",b[record].number[i]);
	return 0;
}
int main()
{
	int m,i,b[26],p,max,j,c;
	scanf ("%d",&m);
	struct point 
	{
		int n;
		char s[26];
	}a[999];
    for (i=0;i<m;i++)
	{
		scanf ("%d %s",&a[i].n,a[i].s);
	}
	for (i=0;i<26;i++)
	{
		b[i]=0;
	}
	for (i=0;i<m;i++)
	{
		for (j=0;a[i].s[j]!='\0';j++)
		{
			if (a[i].s[j]=='A')
				b[0]++;
			else if (a[i].s[j]=='B')
				b[1]++;
			else if (a[i].s[j]=='C')
				b[2]++;
			else if (a[i].s[j]=='D')
				b[3]++;
			else if (a[i].s[j]=='E')
				b[4]++;
			else if (a[i].s[j]=='f')
				b[5]++;
			else if (a[i].s[j]=='G')
				b[6]++;
			else if (a[i].s[j]=='H')
				b[7]++;
			else if (a[i].s[j]=='I')
				b[8]++;
			else if (a[i].s[j]=='J')
				b[9]++;
			else if (a[i].s[j]=='K')
				b[10]++;
			else if (a[i].s[j]=='L')
				b[11]++;
			else if (a[i].s[j]=='M')
				b[12]++;
			else if (a[i].s[j]=='N')
				b[13]++;
			else if (a[i].s[j]=='O')
				b[14]++;
			else if (a[i].s[j]=='P')
				b[15]++;
			else if (a[i].s[j]=='Q')
				b[16]++;
			else if (a[i].s[j]=='R')
				b[17]++;
			else if (a[i].s[j]=='S')
				b[18]++;
			else if (a[i].s[j]=='T')
				b[19]++;
			else if (a[i].s[j]=='U')
				b[20]++;
			else if (a[i].s[j]=='V')
				b[21]++;
			else if (a[i].s[j]=='W')
				b[22]++;
			else if (a[i].s[j]=='X')
				b[23]++;
             else if (a[i].s[j]=='Y')
				b[24]++;
	          else if (a[i].s[j]=='Z')
				b[25]++;
		}
	}
	p=0;
	max=b[0];
	for (i=0;i<26;i++)
	{
		if (b[i]>max)
		{
			p=i;
			max=b[i];
		}
	}
	c=(p+'A');
	printf ("%c\n%d\n",c,max);
	for (i=0;i<m;i++)
	{
		for (j=0;a[i].s[j]!='\0';j++)
		{
			if (a[i].s[j]==(p+'A'))
				printf("%d\n",a[i].n);
		}
	}
	return 0;
}
struct book
{
	int id;
	char writer[30];
}book[1200];
int main()
{
	int n,l,t,a[30];
	char m;
	cin>>n;
	for(int i=0;i<30;i++)  a[i]=0;
	for(int i=0;i<n;i++)
	{
		cin>>book[i].id>>book[i].writer;
		l=strlen(book[i].writer);
		for(int j=0;j<l;j++)
		{
			t=book[i].writer[j]-65;
			a[t]++;
		}
	}
	t=a[0];l=0;
	for(int i=0;i<26;i++)
	{
		if(a[i]>t)
		{
			l=i;
			t=a[i];
		}
	}
	m=l+65;
	cout<<m<<endl;
	cout<<t<<endl;
	for(int i=0;i<30;i++)  a[i]=0;
	for(int i=0;i<n;i++)
	{
		l=strlen(book[i].writer);
		for(int j=0;j<l;j++)
		{
			if(book[i].writer[j]==m)
				cout<<book[i].id<<endl;
		}
	}
	return 0;
}
/*????????m?10 ? m ? 999??????????n?2 ? n ? 26?
????????????????m?????????1?999???????????'A'?'Z'??
??????????????????????????????*/

void main()
{
	int i,j,n,m,x[26]={0},y=0,z;
	char a[100][4],b[100][10],c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s %s",a[i],b[i]);
	}
	for(i=0;i<n;i++)
	{
		m=strlen(b[i]);
		for(j=0;j<m;j++)
		{
			x[b[i][j]-65]++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(y<x[i])
		{
			y=x[i];
			z=i;
		}
	}
	c=z+65;
	printf("%c\n%d\n",c,y);
	for(i=0;i<n;i++)
	{
		m=strlen(b[i]);
		y=0;
		for(j=0;j<m;j++)
		{
			if(b[i][j]==c)y=1;
		}
		if(y==1)printf("%s\n",a[i]);
	}
}
struct s
{
	long h;//??????????
	char z[1000];
	struct s *next;
};

struct s *create(int n)
{
	struct s *head,*p1,*p2;
	int i=0;
	p1=p2=(struct s *)malloc(len);
	scanf("%ld %s",&p1->h,p1->z);//???????????????????
	head=0;
	while(i<n-1)//???????
	{
		i++;
		if(i==1) head=p1;
		else
		p2->next=p1;
		p2=p1;
		p1=(struct s *)malloc(len);
		scanf("%ld %s",&p1->h,p1->z);
	}
	p2->next=p1;
	p1->next=0;
	return head;
}

void main()
{
	int m,i,n,num[26]={0},j;
	struct s *p1,*head; 
	char c,*p2;
	scanf("%d",&n);
	head=create(n);
	p1=head;
	for(i=0;i<n;i++)
	{
		for(p2=p1->z;*p2!='\0';p2++)
		{
			j=*p2-65;
			num[j]++;
		}
		p1=p1->next;
	}
	m=num[0];
	j=0;
	for(i=0;i<26;i++)
	{
		if(num[i]>m)
		{
			m=num[i];
			j=i;
		}
	}
	c=j+65;
	printf("%c\n",c);
	printf("%d\n",num[j]);
	p1=head;
	for(i=0;i<n;i++)
	{
		for(p2=p1->z;*p2!='\0';p2++)
		{
			if(*p2==c)
			{
				printf("%ld\n",p1->h);
				break;
			}
		}
		p1=p1->next;
	}
}
void main()
{
struct book
{
int n;
char a[26];
};
struct book book[999];
int m,c[26]={0},k;
char w[26];
scanf("%d",&m);
int i,j,max=0,t;
for(i=0;i<m;i++)
   scanf("%d %s",&book[i].n,book[i].a);
for(i=0;i<26;i++)
w[i]='A'+i;
for(i=0;i<26;i++)
	for(j=0;j<m;j++)
		for(k=0;k<26;k++)
		{
		    if(book[j].a[k]==w[i])
				c[i]++;
		}
for(i=0;i<26;i++)
{
	if(c[i]>max)
    max=c[i];
}
for(i=0;i<26;i++)
{
	if(c[i]==max)
	{t=i;
     break;}
}
printf("%c\n%d\n",w[t],c[t]);
for(j=0;j<m;j++)
	   for(k=0;k<26;k++)
	   {
		  if(book[j].a[k]==w[t])
		  { printf("%d\n",book[j].n);
		  break;}
	   }
}
int main()
{
    char m = 0;
    int cnt[255], i, j, n;
    struct {
        int id;
        char au[32];
    } bk[1000];
    
    memset(cnt, 0, sizeof(cnt));
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d%s", &bk[i].id, bk[i].au);
        for (j = 0; bk[i].au[j]; j++)
            if (++cnt[bk[i].au[j]] > cnt[m])
                m = bk[i].au[j];
    }
    
    printf("%c\n%d\n", m, cnt[m]);
    for (i = 0; i < n; i++)
        if (strchr(bk[i].au, m))
            printf("%d\n", bk[i].id);
    
    return 0;
}
struct book
{
	int id;
	char author[26];
};
int main()
{
	struct book b[999]; 
	int a[26];
	int m,i,j,max,maxauthor;
	char c;
	scanf("%d",&m);
	for (i=0;i<m;i++)
	{
		scanf("%d %s",&b[i].id,b[i].author);
	}
	for (i=0;i<26;i++)
	{
		a[i]=0;
	}
	for (i=0;i<m;i++)
	{
		for (j=0;b[i].author[j]!='\0';j++)
		{
			c=b[i].author[j];
			a[c-65]++;
		}
	}
	max=a[0];
	maxauthor=0;
	for (i=1;i<26;i++)
	{
		if (a[i]>max)
		{
			max=a[i];
			maxauthor=i;
		}
	}
	printf("%c\n%d\n",maxauthor+65,max);
	for (i=0;i<m;i++)
	{
		for (j=0;b[i].author[j]!='\0';j++)
		{
			c=b[i].author[j];
			if (c==maxauthor+65)
			{
				printf("%d\n",b[i].id);
				break;
			}
		}
	}
	return 0;
}
struct book
{
	int id;
	char writer[26];
	int length;
}zz[999];
int main()
{
	int n,i,j,k;
	int letter[26]={0};
	int letter_book[26][999]={0};
	cin>>n;
	for ( i = 0 ; i < n; i ++ )
	{
		cin>>zz[i].id;
		cin>>zz[i].writer;
		zz[i].length=strlen(zz[i].writer);
	}

	for ( j = 0 ; j < n ; j ++ )
	{
		for ( k = 0 ; k < zz[j].length ; k ++  )
		{
				
			letter_book[zz[j].writer[k] - 'A'][letter[zz[j].writer[k] - 'A']] = zz[j].id;
			letter[zz[j].writer[k] - 'A'] ++;
		}
	}
	int max=0,t;
	for ( i = 0 ; i < 26 ; i ++ )
	{
		if ( letter[i] > max )
		{	
			max = letter[i];
			t = i;
		}
	}
	char m;
	m = 'A' + t ;
	cout<<m<<endl;
	cout<<max<<endl;
	for ( i = 0 ; i < max ; i ++ )
		cout<<letter_book[t][i]<<endl;
}