semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
struct book
{
        int mun;
        char name[26];
}a[999];
int main()
{
        int n,i,j,l,q=0;
        char k;
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
                scanf("%d %s",&a[i].mun,a[i].name);
        }
        int w[26]={0};
        for(i=0;i<n;i++)
        {
                l=strlen(a[i].name);
                for(j=0;j<l;j++)
                {
                        k=a[i].name[j];
                        w[k-65]++;
                        /*for(k='A';k<='Z';k++)
                        {
                                if(a[i].name[j]==k)
                                {
                                        q=k-65;
                                        w[q]++;
                                }
                        }*/
                }
        }
        int max;
        max=w[0];
        int flag=0;
        for(i=0;i<26;i++)
        {
                if(w[i]>max)
                {max=w[i];flag=i;}
        }
        printf("%c\n",flag+65);
        printf("%d\n",w[flag]);
        for(i=0;i<n;i++)
        {
                l=strlen(a[i].name);
                for(j=0;j<l;j++)
                {
                if(a[i].name[j]==(flag+65))
                        printf("%d\n",a[i].mun);
                }
        }
        return 0;
}
struct author
{
	char name[26];
	int num;
	struct author *next;
};
void main()
{
	int i,n,a[26],j,t;
	struct author *head;
	struct author *p1,*p2;
	p1=p2=(struct author *)malloc(LEN);
	head=NULL;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&p1->num,p1->name);
		if(i==0) head=p1;
		else p2=p1;
		if(i!=(n-1)) p1=p2->next=(struct author*)malloc(LEN);
		else {p2->next=NULL;}
	}
	for(i=0;i<26;i++)
	{
		a[i]=0;
	}
	p1=head;
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(j=0;j<strlen(p1->name);j++)
		{
			a[p1->name[j]-'A']++;
		}
	}
	t=0;
	for(i=0;i<26;i++)
	{
		if(a[i]>a[t]) t=i;
	}
	printf("%c\n%d\n",t+'A',a[t]);
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		for(j=0;j<strlen(p1->name);j++)
		{
			if(p1->name[j]==t+'A') printf("%d\n",p1->num);continue;
		}
	}
}
void main()
{
	int n,i,j,l,a[100],b[26],s,max;
	char c[100][50],m;
	for(i=0;i<=25;i++)
		b[i]=0;
	scanf("%d",&n);

    for(i=0;i<=n-1;i++)
	{
		scanf("%d%s",&a[i],c[i]);
	   l=strlen(c[i]);
	    for(j=0;j<=l-1;j++)
		{s=(int)c[i][j]-65;
		b[s]=b[s]+1;}}
	
	max=b[0];
	j=0;

   for(i=0;i<=25;i++)
   {  if(b[i]>max)
   {max=b[i];
   j=i;}}
   m=j+65;

   printf("%c\n",m);
   printf("%d\n",max);

    for(i=0;i<=n-1;i++)
	{  l=strlen(c[i]);
	    for(j=0;j<=l-1;j++)
		if(c[i][j]==m)
			printf("%d\n",a[i]);
	}
}
struct book{
	int num;
	char writer[26];
	struct book *next;
};
void main()
{
	int n,i,j,a[26]={0},max,temp;                 /*a[i]???????0*/
	char c;
	struct book *p,*head,*tail;
	scanf("%d",&n);
	head=NULL;tail=NULL;
	for(i=0;i<n;i++){
		p=(struct book*)malloc(len);
		scanf("%d %s",&p->num,p->writer);
		if(head==NULL)                              /*???????????=??????????????????*/
			head=tail=p;
		else{
			tail->next=p;
			tail=p;
		}
	}
	for(c='A';c<='Z';c++){
		for(i=0,p=head;i<n;i++,p=p->next)
		{
			for(j=0;p->writer[j]!='\0';j++)
				if(p->writer[j]==c)    
					a[c-'A']++;                     /*????break,??????*/
		}	                                        /*??a[26]????????????????????????????????????????????????????????????*/
	}
	max=a[0];
	for(i=0;i<26;i++)
		if(a[i]>max)
			max=a[i];                                
	for(i=0;i<26;i++)
		if(a[i]==max)
			break;
	c=i+'A';
	printf("%c\n",c);
	printf("%d\n",a[i]);                              
	for(i=0,p=head;i<n;i++,p=p->next)
		{
			for(j=0;p->writer[j]!='\0';j++)                   
				if(p->writer[j]==c){
					printf("%d\n",p->num);break;
				}
		}
}
struct book 
{
	int num;
	char zhuzhe[26];
	int let;
};

struct book shu[1000];

int judge(char a,char b)
{
  if(a==b)return(1);
  else return(0);
}

void main()
{
	int n,i,j,y,zhi,num; 
	char writer1[26]={0};
char writer2[26]={0};

for(i=0;i<26;i++)
writer2[i]=i+65;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{scanf("%d",&shu[i].num);
	gets(shu[i].zhuzhe);
	}
for(i=0;i<n;i++)
 for(j=0;shu[i].zhuzhe[j]!='\0';j++)
  for(y=0;y<26;y++)
	  if(writer2[y]==shu[i].zhuzhe[j])writer1[y]=writer1[y]+1;
zhi=0;
num=0;
for(i=0;i<26;i++)
if(writer1[i]>zhi){zhi=writer1[i];num=i;}


for(i=0;i<n;i++)
  for(j=0;shu[i].zhuzhe[j]!='\0';j++)
     if(judge(shu[i].zhuzhe[j],writer2[num])==1)shu[i].let=1;

printf("%c\n",writer2[num]);
printf("%d\n",writer1[num]);
for(i=0;i<n-1;i++)
if(shu[i].let==1)printf("%d\n",shu[i].num);
if(shu[n-1].let==1)printf("%d",shu[n-1].num);
}
int N;
int A[2013],Ans[1222];
char W[2013][28];
double Max(double X,double Y)
{
	return X > Y ? X : Y;
}
int main()
{
	cin >> N;
	for (int I = 1; I <= N; I ++)
		cin >> A[I] >> W[I];
	for (int I = 1; I <= N; I ++)
	{
		int L = strlen(W[I]);
		for (int J = 0; J < L; J ++) Ans[W[I][J]] ++;
	}
	int Max = 0,T;
	for (int I = 65; I <= 'Z'; I ++)
		if (Ans[I] > Max)
		{
			Max = Ans[I];
			T = I;
		}
	printf("%c\n%d\n",T,Max);
	for (int I = 1; I <= N; I ++)
	{
		int L = strlen(W[I]);
		for (int J = 0; J < L; J ++)
			if (W[I][J] == T) cout << A[I] << endl;
	}
}
int main ()
{
	int m, i, j, num[999], store[26][999] = {0} , cal[26] = {0}, max = 0, maxnum;
	char au[999][26];
	cin >> m;
	for(i = 0; i <= m - 1; i++)
	{
		cin >> num[i];
		cin.get();
		cin.getline(au[i], 26);
		for (j = 0; ;j++)
		{
			if(au[i][j] == '\0')
				break;
			else
			{
				store[au[i][j] - 'A'][cal[au[i][j] - 'A']] = num[i];
				cal[au[i][j] - 'A']++;
			}
		}
	}
	for(i = 0; i <= 25; i++)
	{
		if (cal[i] > max)
		{
			max = cal[i];
			maxnum = i;
		}
	}
	char t = 'A' + maxnum;
	cout << t << endl << max << endl;
	for(i = 0; i < max ; i++)
	{
		cout << store[maxnum][i] << endl;
	}
	return 0;
}
void main()
{
	int n,i,j,k;
	int at[26]={0};
	char c;
	scanf("%d",&n);
	struct st
	{
		int id;
		char s[27];
	}a[999],*p;
	for(p=a;p<a+n;p++)scanf("%d %s",&p->id,p->s);
	for(i=0;i<n;i++)
	{
		for(j=0;;j++)
		{
			c=a[i].s[j];
			if(c!='\0')at[c-65]++;
			else break;
		}
	}
	int max=0;
	for(i=0;i<26;i++)
	{
		if(at[i]>max)
		{
			max=at[i];
			j=i;
		}
	}
	char x;
	x=j+65;	
	printf("%c\n%d\n",x,max);
	for(i=0;i<n;i++)
	{
		for(j=0;;j++)
		{
			c=a[i].s[j];
			if(c==x)printf("%d\n",a[i].id);
			if(c=='\0')break;
		}
	}
}
struct book{
	int num;
	char author[27];
};
int main()
{
 int n,m,i,j;
 int author_num[26]={0};
 scanf("%d",&n);
 struct book shu[999];
 for(i=0;i<n;i++){
  scanf("%d%s",&shu[i].num,shu[i].author);
 }
 for(i=0;i<n;i++){
	 for(j=0;j<26;j++){
		 m=shu[i].author[j]-'A';
		 author_num[m]++;
	 }
 }
 int max=author_num[0],author='A';
 for(i=1;i<26;i++){
	 if(author_num[i]>max){
		 max=author_num[i];
		 author=i+'A';
	 }
 }
printf("%c\n%d\n",author,max);
for(i=0;i<n;i++){
	 for(j=0;j<26;j++){
		 if(shu[i].author[j]==author){
			 printf("%d\n",shu[i].num);
		 }
	 }
}
return 0;
}
//
//  main.cpp
//  ????
//
//  Created by ???? on 13-12-25.
//  Copyright (c) 2013? ????. All rights reserved.
//

int main()
{
    
    struct author_book
    {
        int count;
        int book[999];
    } au[26];
    
    for(int k=0;k<26;k++)
    {
        au[k].count=0;
    }
    
    
    int m;
    cin>>m;
    
    
    for(int i=1;i<=m;i++)
    {
        int num;
        char a[26];
        cin>>num;
       cin.get();
        cin.getline(a,26);
        for(int k=0;k<strlen(a);k++)
        {
            int author_r=(int)(a[k]-'A');//?????
            au[author_r].book[  au[author_r].count  ]=num;
            au[author_r].count++;
        }
    }
    
    //find the max
    int max=0;
    int the_one=0;
    for(int i=0;i<26;i++)
    {
        //cout<<au[i].count<<endl;
        if(au[i].count>max)
        {
            max=au[i].count;
            the_one=i;
        }
    }
    
    //cout author
    char maxau='A'+the_one;
    cout<<maxau<<endl;
    cout<<au[the_one].count<<endl;
    //cout his books
    for(int i=0;i<au[the_one].count;i++)
    {
        cout<<au[the_one].book[i]<<endl;
    }
    
    return 0;
}
struct inf
{
	int num;
	char name[26];
	struct inf *next;
};

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

void count(struct inf *head,int o)
{
	struct inf *q1;
	int *q2,*q3,*q4;
	char *t1;
	q1=head;
	q2=(int *)malloc(26*LEM);
    for(q3=q2;q3<q2+26;q3++)
        *q3=0;
	while(q1!=NULL)
	{
		for(t1=q1->name;*t1!='\0';t1++)
			*(q2+(*t1-'A'))=*(q2+(*t1-'A'))+1;
		q1=q1->next;
	}
	q4=q2;
    for(q3=q2;q3<q2+26;q3++)
		if(*q4<*q3)
			q4=q3;
	printf("%c\n%d\n",q4-q2+'A',*q4);
	q1=head;
	while(q1!=NULL)
	{
        for(t1=q1->name;*t1!='\0';t1++)
			if(*t1==(q4-q2+'A'))
				printf("%d\n",q1->num);
		q1=q1->next;
	}

    
}



void main()
{
	struct inf *head,*s;
	scanf("%d",&m);
	head=creat();
	s=head;
	count(head,m);
/*	while(s!=NULL)
	{
		printf("%d %s\n",s->num,s->name);
		s=s->next;
	}*/
}
int main()
{
    char a[1000][26], t; 
	int b[1000], num[26] = {0}, n, i, j, k, max, l[1000];
	cin >> n;
	max = 0;
	for (i = 1; i <= n; i++)
	{
		cin >> b[i];
		gets(a[i]);
		l[i] = strlen(a[i]);
		for (j = 1; j <= l[i]; j++)
			num[a[i][j] - 'A']++;
	}
	for (i = 0; i <= 25; i++)
		if (num[i] > max)
		{
			max = num[i];
			t = i + 'A';
		}
	cout << t << endl;
	cout << max << endl;
	for (i = 1; i <= n; i++)
		for (j = 1; j <= l[i]; j++)
			if (a[i][j] == t)
				cout << b[i] << endl;
	return 0;
}
void main()
{
	int a,m,i,max=0,n,count[26]={0};
	char b;
	struct book
	{
		int id;
		char author[26];
	}book[1024];
		char *p=&book[0].author[0];
		char *q;
   scanf("%d",&m);
   for(i=0;i<m;i++)
   {   
	   scanf("%d %s",&book[i].id,book[i].author);
   }
/*
   for(i=0;i<m;i++)
   {   
	   printf("%d %s\n",book[i].id,book[i].author);
   }
*/   
   for(i=0;i<m;i++)

	for(p=book[i].author;*p!='\0';p++)
	{
		a=*p;
		count[a-65]++;
	}
	for(i=0;i<26;i++)
	{
		if(max<count[i])
		{
			max=count[i];
		    b='A'+i;
		}
	}
	printf("%c\n%d\n",b,max);

	for(i=0;i<m;i++)
	{
		for(q=book[i].author;*q!='\0';q++)
		{
			if(*q==b)	printf("%d\n",book[i].id);
		}
	}
}
int n,i,p,j,t,q;
int SAVER[1500];
char R[1500][50];
int RR[50];

int main()
{
	cin>>n;
	t=0;
	for (i=1;i<=n;i++)
	{
		cin>>SAVER[i];
		cin.get();
		cin>>R[i];
		j=0;
		while (R[i][j]!='\0')
		{
			RR[R[i][j]-'A']++;
			j++;
		}
	}
	for (i='A';i<='Z';i++)
		if (RR[i-'A']>t)
		{
			t=RR[i-'A'];
			q=i;
		}
	cout<<(char)q<<endl<<t<<endl;
	for (i=1;i<=n;i++)
	{
		j=0;
		while (R[i][j]!='\0')
		{
			if (R[i][j]==q) cout<<SAVER[i]<<endl;
			j++;
		}
	}
	return 0;
}
int main()
{
    int num,i,j;
    char a='A';
    int count[27]={0};
    int *p=&count[1];
    scanf("%d",&num);
    struct book
    {
           char order[4];
           char author[26];
    }book[1000];
    for(i=0;i<num;i++)
    {
                      scanf("%s",book[i].order);
                      scanf("%s",book[i].author);
    }
    for(i=0;i<num;i++)
    {
                      int m=strlen(book[i].author);
                      for(j=0;j<m;j++)
                      {
                                      if(book[i].author[j]=='A')count[1]++;
                                      if(book[i].author[j]=='B')count[2]++;
                                      if(book[i].author[j]=='C')count[3]++;
                                      if(book[i].author[j]=='D')count[4]++;
                                      if(book[i].author[j]=='E')count[5]++;
                                      if(book[i].author[j]=='F')count[6]++;
                                      if(book[i].author[j]=='G')count[7]++;
                                      if(book[i].author[j]=='H')count[8]++;
                                      if(book[i].author[j]=='I')count[9]++;
                                      if(book[i].author[j]=='J')count[10]++;
                                      if(book[i].author[j]=='K')count[11]++;
                                      if(book[i].author[j]=='L')count[12]++;
                                      if(book[i].author[j]=='M')count[13]++;
                                      if(book[i].author[j]=='N')count[14]++;
                                      if(book[i].author[j]=='O')count[15]++;
                                      if(book[i].author[j]=='P')count[16]++;
                                      if(book[i].author[j]=='Q')count[17]++;
                                      if(book[i].author[j]=='R')count[18]++;
                                      if(book[i].author[j]=='S')count[19]++;
                                      if(book[i].author[j]=='T')count[20]++;
                                      if(book[i].author[j]=='U')count[21]++;
                                      if(book[i].author[j]=='V')count[22]++;
                                      if(book[i].author[j]=='W')count[23]++;
                                      if(book[i].author[j]=='X')count[24]++;
                                      if(book[i].author[j]=='Y')count[25]++;
                                      if(book[i].author[j]=='Z')count[26]++;
                      }
    }
    for(i=1;i<27;i++)
    {
                     if(count[i]>*p)
                     {
                                         p=&count[i];
                                         a=i+64;
                     }
    }
    printf("%c\n%d\n",a,*p);
    for(i=0;i<num;i++)
    {
                      for(j=0;j<strlen(book[i].author);j++)
                      {
                                                           if(book[i].author[j]==a)
                                                           printf("%s\n",book[i].order);
                      }
    }
   
    return 0;
}
struct book
{
	char writer[26];
	int num;
	struct book *next;
};
struct book *creat()
{
	struct book *head,*p1,*p2;
	int i,m;
	scanf("%d",&m);
	p1=p2=(struct book *)malloc(sizeof(struct book));
	head=NULL;
	for(i=0;i<m;i++)
	{
		if(i==0) head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct book *)malloc(sizeof(struct book));
		scanf("%d %s",&p1->num,p1->writer);
		p1->next=NULL;
	}
	p2->next=p1;
	return(head);
}
void main()
{
	int n,a[26][1000]={0},b[26]={0},i,max,k;
	struct book *head,*p;
	char *q;
	head=creat();
	for(p=head->next;p;p=p->next)
	{
		n=strlen(p->writer);
		for(i=0,q=p->writer;i<n;i++,q++)
		{
			a[*q-65][b[*q-65]]=p->num;
			b[*q-65]++;
		}
	}
	max=b[0];
	k=0;
	for(i=0;i<26;i++)
	{
		if(b[i]>max)
		{
			max=b[i];
			k=i;
		}
	}
	printf("%c\n%d\n",k+65,max);
	for(i=0;i<max;i++)
		printf("%d\n",a[k][i]);
}
/*????????m?10 ? m ? 999??????????n?2 ? n ? 26?????????????????m?????????1?999??
?????????'A'?'Z'????????????????????????????????
??????????m???m??????????????????????????
???????????????????????????????????????????*/

int main()
{
	int m;
	cin>>m;
	char str[1000][26];
	int a[1000],count[26]={0};
	int t=0;
	int shu=0;

	for (int i=0;i<m;i++)
	{
		t=0;
		cin>>a[i];
		cin>>str[i];
		t=strlen(str[i]);
		for (int j=0;j<t;j++)
		{
			shu=str[i][j]-'A';
			count[shu]++;
		}
	}


	int max=count[0];
	int hao=0;

	for (int k=1;k<26;k++)
	{
		if (count[k]>max)
		{
			max=count[k];
			hao=k;
		}
	}

	char c=hao+'A';

	cout<<c<<endl;
	cout<<max<<endl;


	for (int l=0;l<m;l++)
	{
		for (int o=0;str[l][o]!='\0';o++)
		{
			if (str[l][o]==c)
			{
				cout<<a[l]<<endl;
				break;
			}
		}
	}
	return 0;
}
int main()
{
	int m,i,j,k,max=-1;
	int c[26];
	char prname;
	struct list
	{
		int num;
		char writer[27];
		int len;
	}book[999];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&book[i].num);
		gets(book[i].writer);
		book[i].len=strlen(book[i].writer);
	}
	for(i=0;i<26;i++)
		c[i]=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<book[i].len;j++)
		{
			switch(book[i].writer[j])
			{
			case 'A':c[0]++;break;
			case 'B':c[1]++;break;
			case 'C':c[2]++;break;
			case 'D':c[3]++;break;
			case 'E':c[4]++;break;
			case 'F':c[5]++;break;
			case 'G':c[6]++;break;
			case 'H':c[7]++;break;
			case 'I':c[8]++;break;
			case 'J':c[9]++;break;
			case 'K':c[10]++;break;
			case 'L':c[11]++;break;
			case 'M':c[12]++;break;
			case 'N':c[13]++;break;
			case 'O':c[14]++;break;
			case 'P':c[15]++;break;
			case 'Q':c[16]++;break;
			case 'R':c[17]++;break;
			case 'S':c[18]++;break;
			case 'T':c[19]++;break;
			case 'U':c[20]++;break;
			case 'V':c[21]++;break;
			case 'W':c[22]++;break;
			case 'X':c[23]++;break;
			case 'Y':c[24]++;break;
			case 'Z':c[25]++;break;
			}
		}
	}
	for(i=0;i<26;i++)
	{
		if(c[i]>max)
			max=c[i];
		else
			continue;
	}
	for(i=0;i<26;i++)
	{
		if(c[i]!=max)
			continue;
		else
		{
			prname=i+65;
			printf("%c\n",prname);
			printf("%d\n",max);
			for(j=0;j<m;j++)
			{
				for(k=0;k<book[j].len;k++)
				{
					if(book[j].writer[k]!=prname)
						continue;
					else
					{
						printf("%d\n",book[j].num);
						break;
					}
				}
			}
			break;
		}
	}
	return 0;
}
int main()
{
    int n,i,j;
    cin >> n;
    char number[1000][5]={' '};
    char authors[1000][30]={' '};
    int author[30]={0};
    for (i=0;i<=n-1;i++)
    {
        cin >> number[i] >> authors[i];
        int len1=strlen(authors[i]);
        
        for (j=0;j<=len1-1;j++)
        {
            author[authors[i][j]-'A']++;
        }
    }
    int k,kmax=0; 
    int max=author[0];
    for (k=1;k<=25;k++)
    {
        if (author[k]>max)
        {
            max=author[k];
            kmax=k;
        }
    }
    char writer=kmax+'A';
    cout << writer << endl;
    cout << max << endl;
    for (i=0;i<=n-1;i++)
    {
        for (j=0;j<=25;j++)
        {
            if (authors[i][j]-'A'==kmax)
            {
                cout << number[i] << endl;
                break;
            }
        }
    }
    
    return 0;
}
struct stu
{
	int n;
	char name[27];
	struct stu *next;
};
void main()
{
	int m;
	scanf("%d",&m);
	struct stu *head,*p1,*p2,*p3;
	head=p1=(struct stu*)malloc(LEN);
	scanf("%d %s",&p1->n,p1->name);
	int i=0;
	for(;i<m-1;i++)
	{
		p2=(struct stu*)malloc(LEN);
		scanf("%d %s",&p2->n,p2->name);
		p1->next=p2;
		p1=p2;
	}
	p2->next=NULL;
	int sum[26];
	for(i=0;i<26;i++) sum[i]=0;
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		char *p=p1->name;
		while(*p!='\0') 
		{
			int a=*p;
			sum[a-65]=sum[a-65]+1;
			p=p+1;
		}
	}
	int max=sum[0];
	char j='A';
	for(i=0;i<26;i++)
	{
		if(sum[i]>max) 
		{
			max=sum[i];
			j=i+65;
		}
	}
	printf("%c\n%d\n",j,max);
	for(p1=head;p1!=NULL;p1=p1->next)
	{
		char *p=p1->name;
		for(;*p!='\0';p++) 
		if(*p==j) 
		{printf("%d\n",p1->n);break;}
	}
}
int main(int argc, char* argv[])
{
    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 node  //??????
{
	int num;
	char name[26];
	struct node *next;
};
int n=1,m;
struct zuozhe
{
	char name;
	int books[300];
	int num;
}zuozhe[26];

struct node  *getlinked()  
{
	struct node *head,*newnode,*thisnode;
//	printf("Please input the number and data (-1 -1 to end):\n");
	do
	{	
		newnode=(struct node *)malloc(sizeof(struct node)); //??????????
		if(newnode==NULL) //malloc???
		{
			printf("malloc failed");
			exit(-1);
		}
		scanf("%d%s",&newnode->num,&newnode->name);
		newnode->next=NULL;
		if(n==1)  //???????????thisnode?head????newnode
		{
			thisnode=newnode;
			head=newnode;
		}
		else //?????????????
		{
			thisnode->next=newnode; 
		}
		if(n<=m)
		{
			thisnode=newnode; //????
			n++; //????
		}
	}while(n<=m);
	return head;
}
void tongji(struct node *p,int n)
{
	int i,j;
	for(i=1;i<=n;i++)
	{
		for(j=0;j<strlen(p->name);j++)
		{
			zuozhe[(p->name)[j]-'A'].books[zuozhe[(p->name)[j]-'A'].num]=p->num;
			zuozhe[(p->name)[j]-'A'].num++;
		}
		p=p->next;
	}
}

void bubble(struct zuozhe array[],int n)
{
	int i=0,pass;
	struct zuozhe temp;

	for(pass=1;pass<=n;pass++)
	{
		for(i=0;i<n-pass;i++)
		{
			if(array[i].num<array[i+1].num)
			{
				temp=array[i];
				array[i]=array[i+1];
				array[i+1]=temp;
			}
		}
	}
	return;
}

void main()
{
	struct node *p;
	int i;
	scanf("%d",&m);
	p=getlinked();
	for(i=0;i<26;i++)
	{
		zuozhe[i].name='A'+i;
		zuozhe[i].num=0;
	}
	tongji(p,m);
	bubble(zuozhe,26);
	printf("%c\n%d\n",zuozhe[0].name,zuozhe[0].num);
	for(i=0;i<zuozhe[0].num;i++)
	{
		printf("%d\n",zuozhe[0].books[i]);
	}
}
struct a
{
	int number;
	char authors[26];
	struct a*next;
};
int n,max=0;
int main()
{
	struct a*create(void);
	char sum(struct a*);
	void pr(char x,struct a*head);
	struct a*head;
	char x;
	scanf("%d",&n);
	head=create();
	x=sum(head);
	pr(x,head);
}
struct a*create(void)
{
	struct a*head,*p1,*p2;
	int i;
	p1=len;head=p1;p2=p1;
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&p1->number,p1->authors);
		if(i!=n-1)
		{p1=len;p2->next=p1;p2=p2->next;}
		else p1->next=null;
	}
	return head;
}
char sum(struct a*head)
{
	struct a*p;
	p=head;
	int a[26]={0},i,j;
	char zd;
	for(i=0;i<n;i++)
	{
		for(j=0;*(p->authors+j)!='\0';j++)
			a[*(p->authors+j)-65]++;
		p=p->next;
	}
	for(i=0;i<26;i++)
		if(a[i]>max){max=a[i];zd=i;}
	printf("%c\n%d",zd+65,a[zd]);
	return(zd+65);
}
void pr(char x,struct a*head)
{
	int i,j,num;
	struct a*p;
	p=head;
	for(i=0;i<n;i++)
	{
		num=0;
		for(j=0;*(p->authors+j)!='\0';j++)
			if(*(p->authors+j)==x)num=1;
		if(num)printf("\n%d",p->number);
		p=p->next;
	}
}
main()
{
   struct h
   {
      char name[27];
	  int mun;
	  struct h *next;
   } *p,*q,*head;
int k,j,i,l,n,a[26][1001],b;
  scanf("%d",&n);

  p=len;
  q=head=p;
  for(i=0;i<26;i++)
		for(j=0;j<1000;j++)
	      a[i][j]=0;
  for(i=0;i<n;i++)
 {
  scanf("%d %s",&p->mun,p->name);
  
  l=strlen(p->name);
  for(j=0;j<l;j++)
  {
     b=(p->name)[j]-65;/*????????*/
	 k=a[b][0]+=1;/*???????????? */
	 a[b][k]=p->mun;/*???p->mun????????*/
  }
  q=len;
  p->next=q;
  p=q;
 }
  p=head;
  int max=a[0][0];
  j=0;
  for(i=0;i<26;i++)
  {
	  if(max<a[i][0]){max=a[i][0];j=i;}
	  
  }
  printf("%c\n%d\n",j+65,max);
  i=1;
  while(a[j][i])
  {
    printf("%d\n",a[j][i]);
	i++;
  } 



}
int main()
{
	struct book
	{
		int num;
		char writer[26];
	}book[999];
	int m,i,n,j,max;
	char a[26],c[26];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&book[i].num,&book[i].writer);
	}
	for(i=0;i<26;i++)
	{
		a[i]=i+65;
		c[i]=0;
	}
	for(i=0;i<26;i++)
	{
		for(j=0;j<m;j++)
		{
			for(n=0;n<26;n++)
			{
				if(a[i]==book[j].writer[n])
				{
					c[i]++;
				}
			}
		}
	}
	max=0;
	for(i=0;i<26;i++)
	{
		if(c[i]>c[max])
		{
			max=i;
		}
	}
	printf("%c\n%d\n",a[max],c[max]);
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++)
		{
			if(book[i].writer[j]==a[max])
			{
				printf("%d\n",book[i].num);
			}
		}
	}
	return 0;
}
void main()
{
	int n,i,j,k=0,name[26]={0},max,a[1000],t=0;
	char word[1000][30];
	scanf("%d",&n);
	for(i=-1;i<n;i++)
	{
		gets(word[i]);
	}
	for(j=0;j<26;j++)
	{
	for(i=0;i<n;i++)
	{
		while(word[i][k]!='\0')
		{
			if(word[i][k]=='A'+j)
			{
				name[j]=name[j]+1;
			}
			k=k+1;
		}
		k=0;
	}
	}
	k=0;
	max=name[0];
	j=0;
	for(i=1;i<26;i++)
	{
		if(name[i]>max)
		{	
		max=name[i];
		j=i;}

	}
	for(i=0;i<n;i++)
	{
		while(word[i][k]!='\0')
		{
			if(word[i][k]=='A'+j)
			{
				
				a[t]=i;
				t=t+1;
				k=0;
				break;
			}
			k=k+1;
		}
		k=0;
	}
	printf("%c\n%d\n",'A'+j,max);
	k=0;
	for(i=0;i<t;i++)
	{
		while(word[a[i]][k]!=' ')
		{
			printf("%c",word[a[i]][k]);
			k=k+1;
		}
		printf("\n");
		k=0;
	}
}