semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	int num[1000],i,j,a[26]={0},len,k,max,l=0;
	char x[1000][10];
	int n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d %s",&num[i],x[i]);
    for(i=0;i<n;i++)
	{
		len=0;
		k=0;
		len=strlen(x[i]);
		for(j=0;j<len;j++)
		{
			k=x[i][j];
			a[k-65]++;
		}
	}
	max=a[0];
	for(j=1;j<26;j++)
	{
		if(a[j]>max) 
		{
			max=a[j];
			l=j;
		}
	}
	printf("%c\n",l+65);
	printf("%d\n",max);
	for(i=0;i<n;i++)
	{
		for(j=0;j<10;j++)
		{
			if(x[i][j]==(l+65)) printf("%d\n",num[i]);
		}
	}
}
void main()
{
  int n,i,j;
  int max,p;
 int mwj;
  int shu[1000];
  char zuo[1000][30];
  int w[26];
  for(i=0;i<26;i++)
	  w[i]=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
  {
	  scanf("%d %s",&shu[i],zuo[i]);
      for(j=0;j<strlen(zuo[i]);j++)
	  {
         w[(zuo[i][j]-65)]=w[(zuo[i][j]-65)]+1;
	  }
  }
  max=w[0];p=0;
  for(i=0;i<26;i++)
  {
	  if(w[i]>max)
	  {
		  max=w[i];
		  p=i;
	  }
  }
  printf("%c\n",p+65);
  printf("%d\n",max);
  for(i=0;i<n;i++)
  {
	  for(j=0;j<strlen(zuo[i]);j++)
	  {
		  mwj=zuo[i][j];
		  if(mwj==p+65)
		  {
			  printf("%d\n",shu[i]);
			  break;
		  }
	  }
	 
  }
}
struct inf
{
	int sum;
	char write[1000][4];
};
int main()
{   
	int m;
	int i,j;
	char name[5];
	char author[27];
	struct inf book[26];
	for(i=0;i<26;i++)
		book[i].sum=0;

	cin >> m ;
	cin.get();

	while( m -->0 )
	{
		cin.get( name,5);
		cin.getline( author,27);
		for(i=0;i <strlen(author);i++)
		{
			book[author[i]-'A'].sum++;
			for( j=0;j<=3;j++)
			{
				if(j<3)
				book[author[i]-'A'].write[book[author[i]-'A'].sum][j] = name[j];
				else
					book[author[i]-'A'].write[book[author[i]-'A'].sum][j]='\0';
			}
		}
	}


	int max=0,t;
	for(i=0;i<26;i++)
	{
		if(book[i].sum>max)
		{
			t=i;
			max = book[i].sum;
		}

	}

	cout << (char)(t+'A')  << endl << book[t].sum << endl;
	for( i=1;i<=book[t].sum;i++)
		cout << book[t].write[i] << endl;
	return 0;
}
main()
{
	int i,j,m,a[26]={0},max=0;
	struct book
	{
		int no;
		char w[26];
	}
	s[1000];
	scanf("%d",&m);
    for (i=0;i<m;i++)
	{
		scanf("%d %s",&s[i].no,s[i].w);
		for (j=0;j<strlen(s[i].w);j++)
			a[s[i].w[j]-'A']++;
	}
	for (i=0;i<26;i++)
	if (a[i]>a[max])
			max=i;
    printf("%c\n%d\n",max+'A',a[max]);
	for (i=0;i<m;i++)
		for (j=0;j<strlen(s[i].w);j++)
			if (s[i].w[j]==max+'A')
				printf("%d\n",s[i].no);
    
}
void main()
{
	int n,a[1000],i,b[26]={0},m,j,max=0,k;
	char str[1000][30];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&a[i],str[i]);
	}
	for(i=0;i<n;i++)
	{
		m=strlen(str[i]);
		for(j=0;j<m;j++)
		{
			if(str[i][j]=='A')
				b[0]++;
			if(str[i][j]=='B')
				b[1]++;
			if(str[i][j]=='C')
				b[2]++;
			if(str[i][j]=='D')
				b[3]++;
			if(str[i][j]=='E')
				b[4]++;
			if(str[i][j]=='F')
				b[5]++;
			if(str[i][j]=='G')
				b[6]++;
			if(str[i][j]=='H')
				b[7]++;
			if(str[i][j]=='I')
				b[8]++;
			if(str[i][j]=='J')
				b[9]++;
			if(str[i][j]=='K')
				b[10]++;
			if(str[i][j]=='L')
				b[11]++;
			if(str[i][j]=='M')
				b[12]++;
			if(str[i][j]=='N')
				b[13]++;
			if(str[i][j]=='O')
				b[14]++;
			if(str[i][j]=='P')
				b[15]++;
			if(str[i][j]=='Q')
				b[16]++;
			if(str[i][j]=='R')
				b[17]++;
			if(str[i][j]=='S')
				b[18]++;
			if(str[i][j]=='T')
				b[19]++;
			if(str[i][j]=='U')
				b[20]++;
			if(str[i][j]=='V')
				b[21]++;
			if(str[i][j]=='W')
				b[22]++;
			if(str[i][j]=='X')
				b[23]++;
			if(str[i][j]=='Y')
				b[24]++;
			if(str[i][j]=='Z')
				b[25]++;
		}
	}
	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<n;i++)
	{
		m=strlen(str[i]);
		for(j=0;j<m;j++)
		{
			if(str[i][j]==k+65)
				printf("%d\n",a[i]);
		}
	}
}
int main()
{
	int num[27] = {0},no[27][1000]={0};
	char s[27],ls;
	int l,i,max,t,j,flag,n,w;
	cin >> t;
	for (i = 1;i <= t;i++)
	{
		cin >> n >> s;
		l =	strlen (s);
		for (j = 0;j <= l-1;j++)
		{
			w = s[j] - 'A' + 1;
			num[w] ++;
			no[w][num[w]] = n;
		}
	}
	max = 0;
	for (i = 1;i <= 26;i++)
		if (num[i] > max)
		{
			max = num[i];
			flag = i;
		}
	ls = (char) 64+flag;
	cout << ls << endl << num[flag] << endl;
	for (i = 1;i <= num[flag];i++)
		cout << no[flag][i] << endl;
	cin >> w;
    return 0;
}
struct book
{
	int num;
	char writer[100];

};


void main()
{
	int n,i,j,a[26],c[100],k,t,d[100],s;
	struct book bo[100];
	
	for(i=0;i<26;i++)
		a[i]=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&bo[i].num);
		scanf("%s",bo[i].writer);
	
	}

	for(i=0;i<n;i++)
	{
		c[i]=strlen(bo[i].writer);
		for(j=0;j<c[i];j++)
		{
			k=bo[i].writer[j]-'A';
			a[k]++;
			
		}	
	
	}

	t=a[0];
	j=0;
	for(i=1;i<26;i++)
	{
		if(a[i]>t)
		{
			j=i;
			t=a[i];		
		}	
	
	}
	s=j;

	printf("%c\n",'A'+j);
    printf("%d\n",t);
	for(i=0;i<n;i++)
	{
		d[i]=0;
		for(j=0;j<c[i];j++)
		{
			if(bo[i].writer[j]==('A'+s))
				d[i]=1;
		
		}
		if(d[i]==1)
			printf("%d\n",bo[i].num);
	
	}


}
int main()
{
	int m,a[1000],i,n,j,k;
	scanf("%d",&m);
	char b[1000][27];
	int count[26]={0};
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&a[i],b[i]);
	}
	for(i=0;i<m;i++)
	{
		n=strlen(b[i]);
		for(j=0;j<n;j++)
		{
			for(k=0;k<26;k++)
			{
				if(b[i][j]==k+65)count[k]++;
			}
		}
	}
	int max,maxk;
	max=count[0];
	maxk=0;
	for(k=0;k<26;k++)
	{
		if(count[k]>max)
		{
			max=count[k];
			maxk=k;
		}
	}
	char mauthor;
	mauthor=maxk+65;
	printf("%c\n%d\n",mauthor,max);
	for(i=0;i<m;i++)
	{
		n=strlen(b[i]);
		for(j=0;j<n;j++)
		{
				if(b[i][j]==mauthor)
				{
					printf("%d\n",a[i]);
					break;
				}
		
		}
	}
	return 0;
}
void main()
{
	struct book
	{
		char num[100],wri[26];
	} bo[1000];
	int i,j,k,l,n,m=0,a[26]={0},mw;
	scanf("%d\n",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s %s",bo[i].num,bo[i].wri);
		l=strlen(bo[i].wri);
		for (j=0;j<l;j++) a[bo[i].wri[j]-65]++;
	}
	for (i=0;i<26;i++) if(a[i]>m) {m=a[i];mw=65+i;}
	printf("%c\n%d\n",mw,m);
	for (i=0;i<n;i++)
	{
		l=strlen(bo[i].wri);
		for (j=0;j<l;j++) if(bo[i].wri[j]==mw) {puts(bo[i].num);break;}
	}
}
struct index
{
	int num;
	char wr[26];
};
int main()
{
	int n,a[26],*pr,max;
	char s[26],*sp,*pt,temp;
	for(pr=a;pr<a+26;pr++)
	{
		*pr=0;
	}
	sp=s;
	*sp=65;
	for(sp=s+1;sp<s+26;sp++)
	{
		*sp=*(sp-1)+1;
	}
	struct index *p;
	scanf("%d",&n);
	struct index *ind=(struct index*)malloc(sizeof(struct index)*n);
	for(p=ind;p<ind+n;p++)
	{
		scanf("%d %s",&p->num,p->wr);
	}
	for(p=ind;p<ind+n;p++)
	{
		for(pt=(*p).wr;pt<(*p).wr+26;pt++)
		{
			for(pr=a,sp=s;sp<s+26;sp++,pr++)
			{
				if(*pt==*sp)
				{
					(*pr)++;
				}
			}
		}
	}
	max=*a;
	temp=65;
	for(pr=a,sp=s;pr<a+26;pr++,sp++)
	{
		if(*pr>max)
		{
			max=*pr;
			temp=*sp;
		}
	}
	for(pr=a,sp=s;sp<s+26;sp++,pr++)
	{
		if(*pr==max)
		{
			printf("%c\n%d\n",*sp,*pr);
		}
	}
	for(p=ind;p<ind+n;p++)
	{
		for(pt=(*p).wr;pt<(*p).wr+26;pt++)
		{
			if(*pt==temp)
			{
				printf("%d\n",(*p).num);
			}
		}
	}
	free(ind);
	return 0;
}
struct info
{
	short int num;
	char author[27];
};

int main()
{
	char findoutmax(struct info a[],int n,int *pt);
	void detect(struct info b[],char writter,int nn);
	char figure;
	int i,n_book,max,*p;
	struct info book[999];
	scanf("%d",&n_book);
	for (i=0;i<n_book;i++)
	{
		scanf("%d %s",&book[i].num , &book[i].author);
	}
	p=&max;
	figure=findoutmax(book,n_book,p);
	printf("%c\n%d\n",figure,max);
	detect(book,figure,n_book);
	return 0;
}

char findoutmax(struct info a[],int n,int *pt)
{
	int i,j,sum[26]={0};
	for (i=0;i<n;i++)
	{
		for (j=0;a[i].author[j]!='\0';j++)
		{
			switch (a[i].author[j])
			{
			case 'A': sum[0]=sum[0]+1; break;
			case 'B': sum[1]=sum[1]+1; break;
			case 'C': sum[2]=sum[2]+1; break;
			case 'D': sum[3]=sum[3]+1; break;
			case 'E': sum[4]=sum[4]+1; break;
			case 'F': sum[5]=sum[5]+1; break;
			case 'G': sum[6]=sum[6]+1; break;
			case 'H': sum[7]=sum[7]+1; break;
			case 'I': sum[8]=sum[8]+1; break;
			case 'J': sum[9]=sum[9]+1; break;
			case 'K': sum[10]=sum[10]+1; break;
			case 'L': sum[11]=sum[11]+1; break;
			case 'M': sum[12]=sum[12]+1; break;
			case 'N': sum[13]=sum[13]+1; break;
			case 'O': sum[14]=sum[14]+1; break;
			case 'P': sum[15]=sum[15]+1; break;
			case 'Q': sum[16]=sum[16]+1; break;
			case 'R': sum[17]=sum[17]+1; break;
			case 'S': sum[18]=sum[18]+1; break;
			case 'T': sum[19]=sum[19]+1; break;
			case 'U': sum[20]=sum[20]+1; break;
			case 'V': sum[21]=sum[21]+1; break;
			case 'W': sum[22]=sum[22]+1; break;
			case 'X': sum[23]=sum[23]+1; break;
			case 'Y': sum[24]=sum[24]+1; break;
			case 'Z': sum[25]=sum[25]+1; break;
			}
		}
	}
	j=0;
	for (i=1;i<26;i++)
	{
		if (sum[j]<sum[i]) j=i;
	}
	*pt=sum[j];
	return (65+j);
}

void detect(struct info b[],char writter,int nn)
{
	int i,j;
	for (i=0;i<nn;i++)
	{
		for (j=0;b[i].author[j]!='\0';j++)
		{
			if (b[i].author[j]==writter)
			{
				printf("%d\n",b[i].num);
			}
		}
	}
}
void main()
{
    int len[1000];
	int b[26];
	int a[1000];
	char str[1000][26];
	int m,i,j,max,num;
	char c;
	int pos,temp;



    scanf("%d",&m);
	for(i=0;i<26;i++)
		b[i]=0;
	for(i=0;i<m;i++)
	{
		scanf("%d ",&a[i]);
		scanf("%s",str[i]);
		len[i]=strlen(str[i]);
		for(j=0;j<len[i];j++)
		{
			temp=str[i][j]-'A';
			b[temp]++;
		}
	}

    max=b[0];
	pos=0;
	for(i=1;i<26;i++)
	{
		if(b[i]>max)
		{
			max=b[i];
			pos=i;
		}
	}
    c=pos+'A';
    printf("%c\n",c);
	printf("%d\n",max);
	num=0;
    	for(i=0;i<m;i++)
		for(j=0;j<len[i];j++)
			if(str[i][j]==c)
			{
				num++;
				if(num<max)
					printf("%d\n",a[i]);
				else printf("%d",a[i]);
			}
}
int main() {
    struct book1 {
        int num;
        char author[20];
    } book[999];
    int time[26]={0};
    int n, i, j, k, maxi, sign=0;
    scanf("%d", &n);
    for (i=0;i<n;i++) {
        scanf("%d%s", &book[i].num, book[i].author);
    }
    for (i=0;i<n;i++) {
        for (j=0;book[i].author[j]!='\0';j++) {
            for (k=0;k<26;k++) {
                if (book[i].author[j]=='A'+k) {
                    time[k]+=1;
                    break;
                }
            }
        }
    }
    maxi=0;
    for(i=0;i<26;i++) {
        if (time[maxi]<time[i]) {
            maxi=i;
        }
    }
    printf("%c\n%d\n", 'A'+maxi, time[maxi]);
    for (i=0;i<n&&sign==0;i++) {
        for (j=0;book[i].author[j]!='\0';j++) {
            if (book[i].author[j]=='A'+maxi) {
                printf("\n%d", book[i].num);
                sign=1;
                break;
            }
        }
    }
    for (;i<n;i++) {
        for (j=0;book[i].author[j]!='\0';j++) {
            if (book[i].author[j]=='A'+maxi) {
                printf("\n%d", book[i].num);
                break;
            }
        }
    }
    return 0;
}
int main()
{
	struct tushu
	{
		int bianhao;
		char zuozhe[26];
	};
	int i,j,n,q=0;
	int count[26]={0};
	scanf("%d",&n);
	struct tushu *pp;
	pp=(struct tushu *)malloc(sizeof(tushu)*n);
	int *m;
	m=(int *)malloc(sizeof(int)*n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&((pp+i)->bianhao),(pp+i)->zuozhe);
	}
	for(i=0;i<n;i++)
	{
		m[i]=strlen(pp[i].zuozhe);
		for(j=0;j<m[i];j++)
		{
			count[pp[i].zuozhe[j]-'A']++;
		}
	}
	int max=0;
	for(i=0;i<26;i++)
	{
		if(count[i]>max){max=count[i];q=i;}
	}
	printf("%c\n%d\n",'A'+q,max);
	for(i=0;i<n;i++)
	{
		for(j=0;j<m[i];j++)
		{
			if(pp[i].zuozhe[j]==('A'+q))printf("%d\n",pp[i].bianhao);
		}
	}

	return 0;
}
struct book
{
	int ISBN;
	char name[26];
}b[999];
int main()
{
	int i,j,m,k[26],max=0;
	char a,d='A';
	for(i=0;i<26;i++)
		k[i]=0;
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d%s",&b[i].ISBN,b[i].name);
	for(a='A';a<='Z';a++)
		for(i=0;i<m;i++)
			for(j=0;j<26;j++)
				if(b[i].name[j]==a)
					k[a-'A']++;	
	for(i=0;i<26;i++)
		if(k[i]>=max)
			max=k[i];
	for(i=0;i<26;i++)
		if(k[i]==max)
		{
			d+=i;
			printf("%c\n",d);
			printf("%d\n",max);		
		}
	for(i=0;i<m;i++)
		for(j=0;j<26;j++)
			if(b[i].name[j]==d)
				printf("%d\n",b[i].ISBN);
	return 0;
}
struct SHU
{
	int bh;
	char bz[26];
};

int main()
{
	int m,i,j,l,k,p;
	int name[200]={0},max,shuhao[1000];
	struct SHU shu[1000];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&shu[i].bh,shu[i].bz);
	}
	for(i=0;i<m;i++)
	{
		l=strlen(shu[i].bz);
		for(j=0;j<l;j++)
		{
			name[shu[i].bz[j]]++;
		}
	}
	max=name[0];
	for(i=0;i<200;i++)
	{
		if(name[i]>max) 
		{
			max=name[i];
			k=i;
		}
	}
	p=0;
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++)
		{
			if(shu[i].bz[j]==k)
			{
				shuhao[p]=shu[i].bh;
				p++;
			}
		}
	}
	printf("%c\n",k);
	printf("%d\n",max);
	for(i=0;i<p;i++)
	{
		printf("%d\n",shuhao[i]);
	}





	return 0;
}
struct student
{int num;
 char s[26];
 
}stu[999];

int main()
{   int m,a[26]={0},i,j,max,k,l=0;
    scanf("%d",&m);
    for(i=0;i<m;i++)
    scanf("%d%s",&stu[i].num,stu[i].s);
	for(i=0;i<26;i++)
	for(k=0;k<m;k++)
       for(j=0;j<strlen(stu[k].s);j++)
		   if(stu[k].s[j]=='A'+i)
			   a[i]++;
	 
       max=a[0];
	for(i=1;i<26;i++)
		if(a[i]>max)
		{	max=a[i];l=i;}
		printf("%c\n",'A'+l);
		printf("%d\n",max);
	for(i=0;i<m;i++)
		for(j=0;j<strlen(stu[i].s);j++)
		   if(stu[i].s[j]=='A'+l)
		   {	printf("%d\n",stu[i].num);
		   break;}

	
	return 0;
}
int main()
{
	int n ;
	cin >> n ;
	int shu ;
	char ppl[27] ;
	int a[26][n+1] ;
	memset( a , 0 , sizeof( a ) ) ;//???
	for( int i = 0 ; i < n ; i ++ )
	{
		memset( ppl , 0 , sizeof( ppl ) ) ;//????
		cin >> shu ;//????
		getchar() ;//???
		cin.getline( ppl , 27 ,'\n' ) ;//????
		for( int j = 0 ; 'A' <= ppl[j] && ppl[j] <= 'Z' ; j ++  )
		{
			a[ (int) ppl[j] - ( int ) 'A' ][0] ++ ;//0????
			a[ (int) ppl[j] - ( int ) 'A' ][ a[ (int) ppl[j] - ( int ) 'A' ][0] ] = shu ;//??????
		}
	}
	int max = 0 , set = 0 ;//??????
	for( int i = 0 ; i < 26 ; i ++ )
	{
		if( a[i][0] > max )
			{
			max = a[i][0] ;
			set = i ;
			}
	}
	cout << ( char ) ( ( int )'A' + set ) << endl ;//???????
	cout << max << endl ;
	for( int i = 1 ; i <= max ; i ++ )
		cout << a[set][i] << endl ;

	return 0 ;
}
void main()
{
int  n,len,i,j,k,max;
int c[26]={0};
char a[26],f,x;
struct book{ int num; char author[26];};
struct book b[1000];
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%d %s",&b[i].num,&b[i].author);
for(i=0;i<n;i++)
{
	strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if('A'<=(x=a[j])&&(x=a[j])<='Z')
c[x-'A']++;
}
max=c[0];k=0;
for(i=0;i<26;i++)
{if(c[i]>max)
{max=c[i];
k=i;
}}
printf("%c\n%d\n",k+'A',max);
for(i=0;i<n;i++)
{
strcpy(a,b[i].author);
len=strlen(a);
for(j=0;j<len;j++)
if((f=a[j])==k+'A')
printf("%d\n",b[i].num);

}




}
struct st
{
	int a;
	char s[26];
	struct st *n;
}
;
struct st *creat(int m)
{
	int i;
	struct st *p1,*p2,*head;
	for(i=0;i<m;i++)
	{
		p1=(struct st *)malloc(len);
		if(i==0)head=p1;
		else p2->n=p1;
		scanf("%d %s",&p1->a,p1->s);
		p2=p1;
	}
	p1->n=NULL;
	return(head);
}
void main()
{
	int m;
	struct st *creat(int m);
	scanf("%d",&m);
	struct st *p,*q;
	p=creat(m);
	q=p;
	int i,j,k;
	int a[26]={0};
	for(i=0;i<m;i++)
	{
		for(j=0;j<(k=strlen(p->s));j++)a[p->s[j]-65]++;
		p=p->n;
	}
	p=q;
	int max=a[0];
	for(i=1;i<26;i++)
	{
		if(a[i]>max)max=a[i];
	}
	char c;
	for(i=0;i<26;i++)
	{
		if(a[i]==max)
		{
			c=i+65;
			printf("%c\n%d\n",c,a[i]);
			break;
		}
	}
	char cc;
	for(i=0;i<m;i++)
	{
		for(j=0;;j++)
		{
			cc=q->s[j];
			if(cc=='\0')break;
			if(c==cc)printf("%d\n",q->a);
		}
		q=q->n;
	}
}
struct book
{
	int no;
	char auth[26];
};
void main()
{
	struct book *head,*BK;
	int m,n,k,i,j,t,q,p,max;
	int a[26]={0};
	scanf("%d",&m);
	BK=(struct book*)malloc(m*LEN);
	head=BK;
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&BK->no,&BK->auth);
		n=strlen(BK->auth);
		for(j=0;j<n;j++)
		{
			k=BK->auth[j]-'A';
			a[k]=a[k]+1;
		}
		BK=BK+1;
	}
	max=a[0];
	t=0;
	for(i=1;i<26;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
			t=i;
		}
	}
	q=t+'A';
	printf("%c\n%d\n",q,max);
	BK=head;
	for(i=0;i<m;i++)
	{
		p=0;
		n=strlen(BK->auth);
		for(j=0;j<n;j++)
		{
			if(BK->auth[j]==q)
			{
				p=1;
				break;
			}
		}
		if(p==1)
		{
			printf("%d\n",BK->no);
		}
		BK=BK+1;
	}
}
int main ()
{
	int n,i,a[1000],m[1000];
	struct {
		char b[26];
	}p[1000];
	int j,k;
	scanf("%d",&n);
	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'};
	int num[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};
	for (i=0;i<n;i++)
	{
		scanf("%d %s",&a[i],p[i].b);
		m[i]=strlen(p[i].b);		
		for (k=0;k<26;k++)
			for (j=0;j<m[i];j++)
			{
				if (p[i].b[j]==c[k])
					num[k]++;
			}
		
	}
	int max=0,local=0;
	for (k=0;k<26;k++)
	{
		if (num[k]>max)
		{
			max=num[k];
			local=k;
		}
	}	
	printf("%c\n",c[local]);
	printf("%d\n",max);
	for (i=0;i<n;i++)
	{
		for (j=0;j<m[i];j++)
		{
			if (p[i].b[j]==c[local])
			printf("%d\n",a[i]);
		}
	}

	return 0;
}
int main()
{
	int k;
	cin>>k;
	int book;
	char writer[26];
	int counter[26]={0};
	int bookbelong[26][999]={0};
	int everynum[26]={0};
	int t=0;
    while(k--)
	{
		cin>>book>>writer;
		int str=strlen(writer);
	    for(int i=0;i<str;i++)

		{	
			int flag=writer[i]-'A';
			counter[flag]++;
		    bookbelong[flag][everynum[flag]++]=book;  
	}
	}
	int max=counter[0];
	int maxnum=0;
	for(int i=0;i<26;i++)
	{
		if(counter[i]>max)
	{
		maxnum=i;
		max=counter[i];
	}}
char writerbest;
writerbest='A'+maxnum;
cout<<writerbest<<endl<<everynum[maxnum]<<endl;
for(int i=0;i<everynum[maxnum];i++)
	cout<< bookbelong[maxnum][i]<<endl;

	




	return 0;
}
void main()
{
	char book[1000][30];
	int n,i,j,k,r,len[1000],a[26][1000]={0},b[26]={0},max,s,c[26];
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
		gets(book[i]);
		scanf("\n");
	}
	for(i=0;i<=n;i++)
		for(j=0;book[i][j]!=' ';j++)
			len[i]=j;
	for(k=0;k<26;k++)
	{
		r=0;
		for(i=0;i<=n;i++)
		{
			for(j=len[i]+1;j<strlen(book[i]);j++)
			{
				if(book[i][j]==k+65)
				{
					b[k]++;
					a[k][r]=i;
					r++;
				}
			}
		}
		c[k]=r;
	}
	max=b[0];
	for(i=1;i<26;i++)
	{
		if(b[i]>=max)
		{
			max=b[i];
			s=i;
		}
	}
	printf("%c\n",s+65);
	printf("%d\n",max);
	for(i=0;i<c[s];i++)
	{
		for(j=0;j<=len[a[s][i]];j++)
			printf("%c",book[a[s][i]][j]);
		printf("\n");
	}
}
struct record
{
	int id;
};

struct YyxNode
{
	struct record m_rec;
	struct YyxNode *next;
};

struct YyxLink
{
	int n;
	struct YyxNode *head;
	struct YyxNode *tail;
};

struct YyxLink *CreateNewLink()
{
	struct YyxLink *newLn;
	struct YyxNode *newNd;
	if(((newLn=(struct YyxLink*)malloc(sizeof(struct YyxLink)))==NULL)
		||((newNd=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL)){
		printf("Error: memory out! (1)");
		exit(-1);
	}

	newLn->n = 0;
	newLn->head = newNd;
	newNd->next = NULL;
	newLn->tail = newNd;

	return newLn;
}

struct YyxLink *AddNode(struct YyxLink *ln, const struct record *rec)
{
	struct YyxNode *newNd;
	if((newNd=(struct YyxNode*)malloc(sizeof(struct YyxNode)))==NULL){
		printf("Error: memory out! (2)");
		exit(-1);
	}

	newNd->m_rec = *rec;
	newNd->next = NULL;

	ln->tail->next = newNd;
	ln->tail = newNd;
	ln->n ++;
	
	return ln;
}

struct YyxLink *ClearLink(struct YyxLink *ln)
{
	struct YyxNode *delNd, *nextNd;
	delNd = ln->head->next;
	for(; delNd!=NULL; delNd=nextNd){
		nextNd = delNd->next;
		free(delNd);
	}

	ln->n = 0;
	ln->head->next = NULL;

	return ln;
}

void FreeLink(struct YyxLink *ln)
{
	ClearLink(ln);
	free(ln->head);
	free(ln);
}

int main()
{
	struct YyxLink **total;
	int m;
	struct record rec;
	char author[27];
	int i;
	char *pch;
	struct YyxNode *nd;

	if((total=(struct YyxLink**)malloc(26*sizeof(struct YyxLink*)))==NULL){
		printf("Error: memory out! (3)\n");
		exit(-1);
	}
	for(i=0; i<26; i++){
		total[i] = CreateNewLink();
	}

	scanf("%d", &m);
	for(; m>0; m--){
		scanf("%d %s", &rec.id, author);
		pch = author;
		for(; *pch!='\0'; pch++){
			AddNode(total[*pch-'A'], &rec);
		}
	}

	m = 0;
	for(i=1; i<26; i++){
		if(total[m]->n<total[i]->n)
			m = i;
	}
	printf("%c\n%d\n", m+'A', total[m]->n);
	nd = total[m]->head->next;
	for(; nd!=NULL; nd=nd->next){
		printf("%d\n", nd->m_rec);
	}

	return 0;
}
void main()
{
	struct book
	{
		int a;
		char b[20];
	}book[999];
	int n,i,k,max,m,j,p;
	int c[999]={0};
	char str1[20],str2[20];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&book[i].a,&book[i].b);
		m=strlen(book[i].b);
        strcpy(str1,book[i].b);
		for(j=0;j<m;j++)
		c[str1[j]]=	c[str1[j]]+1;
	}
	max=0;
	for(p=65;p<91;p++)
	{
		if(c[p]>max)
		{max=c[p];
		k=p;}
	}
printf("%c\n",k);
printf("%d\n",max);
for(i=0;i<n;i++)
{
	strcpy(str2,book[i].b);
		m=strlen(book[i].b);
		for(j=0;j<m;j++)
		{if(str2[j]==k)
		printf("%d\n",book[i].a);}
}
	

}
int c[26];
char b[1000][100];
char out;

int main(int argc, char* argv[])
{
	int n,i,j,tmp=0,tmp1=0,tmp2;
	int a[1000];
	out='A';
	scanf ("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf ("%d %s",&a[i],b[i]);
		for (j=0;j<strlen(b[i]);j++)
		{
			if (b[i][j]=='A')     c[0]++;if (b[i][j]=='B')     c[1]++;if (b[i][j]=='C')     c[2]++;if (b[i][j]=='D')     c[3]++;
			if (b[i][j]=='E')     c[4]++;if (b[i][j]=='F')     c[5]++;if (b[i][j]=='G')     c[6]++;if (b[i][j]=='H')     c[7]++;
			if (b[i][j]=='I')     c[8]++;if (b[i][j]=='J')     c[9]++;if (b[i][j]=='K')     c[10]++;if (b[i][j]=='L')     c[11]++;
			if (b[i][j]=='M')     c[12]++;if (b[i][j]=='N')     c[13]++;if (b[i][j]=='O')     c[14]++;if (b[i][j]=='P')     c[15]++;
			if (b[i][j]=='Q')     c[16]++;if (b[i][j]=='R')     c[17]++;if (b[i][j]=='S')     c[18]++;if (b[i][j]=='T')     c[19]++;
			if (b[i][j]=='U')     c[20]++;if (b[i][j]=='V')     c[21]++;if (b[i][j]=='W')     c[22]++;if (b[i][j]=='X')     c[23]++;
			if (b[i][j]=='Y')     c[24]++;if (b[i][j]=='Z')     c[25]++;
		}
	}
	for (i=0;i<26;i++)
	{

		if (c[i]>tmp)
		{
			tmp=c[i];
			tmp1=i;
		}
	}
 
    printf ("%c\n%d\n",out+tmp1,tmp);
	for (i=0;i<n;i++)
	{
		for (j=0;b[i][j]!='\0';j++)
		{
			tmp2=b[i][j];
		
			if (tmp2==(out+tmp1))
			{
				printf("%d\n",a[i]);
				break;
			}
		}
	}
	return 0;
}
int main()
{
	int m;
	int book[1020];
	scanf("%d",&m);
	int i;
	char c;
	int a[27]={0};
	int b[27][1000]={0};
	for(i=1;i<=m;i++)
	{
		scanf("%d",&book[i]);
		getchar();
		for(;;)
		{
			scanf("%c",&c);
			if(c=='\n') break;
			a[c-64]+=1;
			b[c-64][i]=1;
		}
	}
	int max=0,p;
	for(i=1;i<27;i++)
	{
		if(a[i]>max) 
		{
			max=a[i];
			p=i;
		}
	}
	printf("%c\n%d\n",p+64,max);
	for(i=0;i<1000;i++)
	{
		if(b[p][i]==1) printf("%d\n",book[i]);
	}
	return 0;
}
int main()
{
	int m,i,a[1000]={0},count[30]={0},temp,j,max=-999,flag;
	char s[1000][30]={0},cha;
	scanf("%d", &m);
	for(i=1;i<=m;i++)
	{
		scanf("%d", &a[i]);
		for(j=1;j<30;j++)
		{
			scanf("%c", &s[i][j]);
			if(s[i][j]==' ') 
			{
				s[i][j]=0;
				continue;
			}
			if(s[i][j]=='\n')
			{
				s[i][j]=0;
				break;
			}
			temp=s[i][j]-'A'+1;
			count[temp]+=1;
		}
	}
	for(i=1;i<=26;i++)
	{
		if(count[i]>=max)
		{
			flag=i;
			max=count[i];
		}
	}
	printf("%c\n%d\n", flag+64,max);
	cha='A'+flag-1;
	for(i=1;i<=m;i++)
	{
		for(j=1;j<30;j++)
		{
			if(s[i][j]==cha)
			{
				printf("%d\n", a[i]);
			}
		}
	}
	return 0;
}
void main()
{
	int n,i,k[100],l[26]={0},m=0,v,j;
	char c[100][26];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&k[i],c[i]);
		for(j=0;j<strlen(c[i]);j++)
		{
			l[(int)c[i][j]-65]+=1;
		}
	}
	for(i=0;i<26;i++)
	{
		if(l[i]>m)
			m=l[i];
	}
	for(i=0;i<26;i++)
	{
		if(l[i]==m)
		{
	        printf("%c\n%d\n",i+65,l[i]);
			break;
		}
	}
	for(v=0;v<n;v++)
	{
		for(j=0;j<strlen(c[v]);j++)
		{
			if(c[v][j]==i+65)
				printf("%d\n",k[v]);
		}
	}
}
int main(){
    int n,i,j,k,b[999],max=0,a[27],x;
    char w,c[999][26],d[27];
    scanf("%d",&n);
    for(i=0;i<n;i++){
                     scanf("%d %s",&b[i],c[i]);
                     }
    for(i=0;i<27;i++)
    {a[i]=0;}
    for(i=0;i<n;i++){
                     for(j=0;j<26;j++){
                                      for(k=65;k<91;k++){
                                                         if(c[i][j]==k)
                                                         a[k-64]++;
                                                         }
                                      }
                     }
    for(i=1;i<27;i++){
                      if(a[i]>max)
                      {max=a[i];
                      x=i;}
                      }
    w=x+64;
    printf("%c\n",w);
    printf("%d\n",max);
    for(i=0;i<n;i++){
                     for(j=0;j<26;j++){
                                       if(c[i][j]==x+64)
                                       {printf("%d\n",b[i]);
                                       break;}
                                       }
                     }
    return 0;
}