semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int n;
    cin >> n;
    int number[n+1];
    int writer[26] = {0};
    char book[n+1][27];
    for(int i = 1; i <= n; ++i)
    {
            cin >> number[i] >> book[i];
            for(int t = 0; t < strlen(book[i]); ++t)
            {
                    writer[book[i][t] -'A']++;
            }
    }
    int nn = 0;
    for(int i = 0; i < 26; ++i)
    {
            nn = max(nn,writer[i]);
    }
    int person1;
    for(int i = 0; i < 26; ++i)
    {
            if(writer[i] == nn)
            {
                         person1 = i;
                         break;
            }
    }
    char person = person1 + 'A';
    cout << person  << endl << nn << endl;
    for(int i = 1; i <= n; ++i)
    {
            for(int t = 0; t < strlen(book[i]); ++t)
            {
                    if(book[i][t] == person)
                    {
                                  cout << number[i] << endl;
                                  break;
                    }
            }
    }
    //while(1);
    return 0;    
}
int main(){
int n,i,j,max=0,b[1000],p[26];
char *bm[1000];
scanf("%d",&n);
for(i=0;i<26;i++)
 p[i]=0;
for(i=0;i<n;i++){
 scanf("%d",&b[i]);
 bm[i]=(char *)malloc(26*sizeof(char));
 scanf("%s",bm[i]);
 for(j=0;j<strlen(bm[i]);j++){
  p[(int)(*(bm[i]+j)-'A')]++;
 }
}
for(i=0;i<26;i++){
 if(p[i]>p[max])
  max=i;
}
printf("%c\n",(char)('A'+max));
printf("%d\n",p[max]);
for(i=0;i<n;i++){
 for(j=0;j<strlen(bm[i]);j++){
   if(bm[i][j]==(char)('A'+max)){
    printf("%d\n",b[i]);    break;
   }
 }
}
return 1;
}
int main()
{
	int m,len[1000],sum[26]={0},max,i,j,i0;
	scanf("%d",&m);
	struct book{
		int num;
		char wri[27];
	}book[1000];
	for(i=0;i<m;i++){
		scanf("%d %s",&book[i].num,book[i].wri);
		len[i]=strlen(book[i].wri);
	}
	for(i=0;i<m;i++)
		for(j=0;j<len[i];j++)
			sum[book[i].wri[j]-65]++;
	max=sum[0];
	i0=0;
	for(i=1;i<26;i++)
		if(sum[i]>max){
			max=sum[i];
			i0=i;
		}
	printf("%c\n",i0+65);
	printf("%d\n",max);
	for(i=0;i<m;i++)
		for(j=0;j<len[i];j++)
			if(book[i].wri[j]==65+i0){
				printf("%d\n",book[i].num);
				break;
			}
	return 0;
}
struct author{
	char num[4];
	char str[27];
};

int main(int argc, char* argv[])
{
	int m,i,j,zimu[26]={0},x,max;
	char p;
	scanf("%d",&m);
	struct author *auth=(struct author *)malloc(sizeof(struct author)*m);
	for(i=0;i<m;i++){
		scanf("%s %s",auth[i].num,auth[i].str);
	}
	for(i=0;i<m;i++){
		for(j=0;j<26;j++){
			x=auth[i].str[j]-65;
			zimu[x]++;
		}
	}
	max=zimu[0];
	for(i=0;i<26;i++){
		if(zimu[i]>max){
			max=zimu[i];
			p=i;
		}
	}
	printf("%c\n%d\n",p+65,max);
	
	for(i=0;i<m;i++){
		for(j=0;j<26;j++){
			if(auth[i].str[j]==p+65){
				printf("%s\n",auth[i].num);
			}
		}
	}

	free(auth);
	return 0;
}
int m;
struct book
{
	int num;
	char name[26];
	struct book *next;
};
struct book *create(void)
{
	struct book *head,*p1,*p2;
	int i;
	scanf("%d",&m);
	p1=(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;
	p1->next=NULL;
	return(head);
}
void main()
{
	int num[26]={0},i,j,max=0;
	struct book *p1,*p2,*head;
	char *p;
	p1=create();
	head=p1;
	for(i=0;i<m;i++)
	{
		for(p=p1->name;*p!='\0';p++)
		{
			num[(*p)-'A']++;
		}
		p1=p1->next;
	}
	for(i=0;i<26;i++)
	{
		if(num[i]>max)
		{
			max=num[i];
			j=i;
		}
	}
	printf("%c\n",('A'+j));
	printf("%d\n",max);
	p1=head;
	for(i=0;i<m;i++)
	{
		p=p1->name;
		for(p=p1->name;*p!='\0';p++)
		{
			if(*p==('A'+j))
			{
				printf("%d\n",p1->num);
				break;
			}
		}
		p1=p1->next;
	}
}
struct book{
	int num;
	char author[26];}shu[999];

int main(int argc, char* argv[])
{
	int m,b,i,*p;
	char c;
	int writer[26];
	char max(int *p);
	scanf("%d",&m);
	for(i=0;i<m;i++){
	scanf("%d%s",&shu[i].num,shu[i].author);}
	for(c='A',writer[c-'A']=0;c<='Z';c++){
		writer[c-'A']=0;
		for(i=0;i<m;i++){
			for(b=0;shu[i].author[b]!='\0';b++){
				if(c==shu[i].author[b]){
	writer[c-'A']++;}}}}
	p=writer;
	printf("%c\n%d\n",max(p),writer[max(p)-'A']);
		for(i=0;i<m;i++){
			for(b=0;shu[i].author[b]!='\0';b++){
				if(max(p)==shu[i].author[b]){
					printf("%d\n",shu[i].num);}}}

	return 0;
}
	char max(int *p){
		int i;
		char max;
		for(i=0,max='A';i<26;i++){
			if(*(p+i)>*(p+max-'A')){
				max=i+'A';}}
		return max;}
void main()
{
	int m,num[1000],i,k,l=0,a[26]={0};
	char nam[1000][10],j;
	scanf("%d",&m);
	for(i=0;i<m;i++)
		scanf("%d%s",&num[i],nam[i]);
    for(j='A';j<='Z';j++)
		for(i=0;i<m;i++)
		    if(strchr(nam[i],j))
				a[j-65]++;
			for(i=0,k=a[0];i<26;i++)
				if(a[i]>k)
				{
					k=a[i];
					l=i;
				}
				printf("%c\n",l+65);
				printf("%d\n",k);
				for(i=0;i<m;i++)
				{
					if(strchr(nam[i],l+65))
						printf("%d\n",num[i]);
				}
}
struct student
{
	int num;
	char zz[20];
	struct student *next;
};

struct student *New(int n)
{
	struct student *head=NULL;
	struct student *newp, *thisp;

	int i=0;

	do
	{
		newp=(struct student*)malloc(sizeof(struct student));
		if (newp==NULL)
		{
			printf("request failed\n");
			exit(-1);
		}
		scanf("%d %s",&newp->num,newp->zz);
		if (i==0)
		{
			head = newp;
			thisp = head;
		}
		else
			thisp->next = newp;
		if (i<n)//????????
		{
			thisp = newp;
			i=i+1;
		}
	}while(i<n);
	thisp->next=NULL;
	return (head);
}

void main()
{
	int i,j;
	int n;
	int t1=0,t2;
	int length;
	char target[1000]={' '};
	char mz=' ';

	struct student *head, *p;

	scanf("%d",&n);

	head=New(n);
	p=head;


	i=0;
	do
	{
		if (i==0)
		{
			strcpy(target,p->zz);
		}
		else
		{
			p = p->next;
			strcat(target,p->zz);
		}
		
		i+=1;
	}while(p->next != NULL);

	length=strlen(target);
	for(i=0;i<length;i++)//??????
	{
		t2=0;
		if (target[i]=='0')
			continue;
		else
		{
			for (j=i+1;j<length;j++)
			{
				if (target[j]==target[i])
				{
					target[j]='0';
					t2+=1;
				}
			}
			if (t2>t1)
			{
				t1=t2;
				mz=target[i];
			}
		}
	}

	printf("%c\n%d",mz,t1+1);

	p=head;
	do
	{
		length=strlen(p->zz);
		for (i=0;i<length;i++)
		{
			if ((p->zz[i])==mz)
			{
				printf("\n%d",p->num);
			}
		}
		p = p->next;
	}while(p != NULL);
}
struct a{
	int n;
	char s[26];
}b[1000];

int main()
{
	int n,i,j,c[26]={0};
	char t;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		int d,m;
		scanf("%d%s",&b[i].n,b[i].s);
		d=strlen(b[i].s);
		for(m=0;m<d;m++)
			c[b[i].s[m]-65]+=1;
	}
	for(i=0;i<26;i++)
		{
			for(j=i+1;j<26;j++)
				if(c[j]>c[i])
					break;
			if(j==26)
				break;
	}
	t=65+i;
	printf("%c\n%d\n",t,c[i]);
	for(i=0;i<n;i++)
	{
		if(strchr(b[i].s,t)!=NULL)
			printf("%d\n",b[i].n);
	}
	return 0;
}
int main()
{
	int i,j,temp=26,n,p[27]={0};
	struct {
		int a;
		char s[30];
	}t[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&t[i].a,t[i].s);
		for(j=0;j<strlen(t[i].s);j++)
		{
			p[t[i].s[j]-'A']++;
		}
	}
	for(i=0;i<26;i++)
	{
		if(p[i]>p[temp])
			temp=i;
	}
	printf("%c\n%d\n",temp+'A',p[temp]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<strlen(t[i].s);j++)
		{
			if(t[i].s[j]==temp+'A')
			{
				printf("%d\n",t[i].a);
				break;
			}
		}
	}
	return 0;
}
struct book
{
	int num;
	char name[27];
}b[1001];
void main()
{
	int n,i,j,k,d,g[27],e=0,f=0,l;
	char m,h;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d %s",&b[i].num,b[i].name);
	m='A';
	for(k=0;k<26;k++)
	{
		d=0;
	    for(i=0;i<n;i++)
		{
			for(j=0;j<26;j++)
			{
				if(b[i].name[j]==m)
					d++;
			    if(b[i].name[j]=='\0')
					break;
			}
		}
		m=m+1;
		g[k]=d;
		if(g[k]>e)
		{
			e=g[k];
			f=k;
		}
	}
	h='A'+f;
	printf("%c\n%d\n",h,e);
	for(i=0;i<n;i++)
	{
		d=0;
		for(j=0;j<26;j++)
		{
			if(b[i].name[j]==h)
				d++;
			if(b[i].name[j]=='\0')
				break;
		}
		if(d!=0)
			printf("%d\n",b[i].num);
	}
}
struct book
{
	int ID;
	char author[30];
	struct book *next;
};
int n,max=0;
char c;

struct book *create()
{
	struct book *head,*p1,*p2;
	p1=(struct book*)malloc(LEN);	
	scanf("%d %s",&p1->ID,p1->author);
	head=p1;
	p2=p1;
	p1->next=NULL;
	
	int i=1;
	do
	{
		if(i==n)break;
        p1=(struct book*)malloc(LEN);
		scanf("%d %s",&p1->ID,p1->author);
		p2->next=p1;
		p2=p1;
		p1->next=NULL;
		i++;
	}while(1);
	return(head);
}





int main()
{
	struct book *head;
	int i;
	int *num;
	num=(int*)malloc(26*sizeof(int));
	for(i=0;i<26;i++)
		*(num+i)=0;
	scanf("%d",&n);
	head=create();
	struct book *p;
	char *s;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			int temp;
			temp=*s-'A';
			(*(num+temp))++;
		}
		p=p->next;
	}
	for(i=0;i<26;i++)
	{
		if(*(num+i)>max)max=*(num+i);
	}
	for(i=0;i<26;i++)
	{
		if(*(num+i)==max)break;
	}
	printf("%c\n%d\n",'A'+i,max);
	c='A'+i;
	p=head;
	while(p)
	{
		for(s=p->author;*s!='\0';s++)
		{
			if(*s==c)break;
		}
		if(*s!='\0')printf("%d\n",p->ID);
		p=p->next;
	}
}
int main()
{struct book
{int m;
char au[26];}b[999];
int m,n[26],M=0,i,j;
scanf("%d",&m);
for(i=0;i<26;i++)
n[i]=0;
for(i=0;i<m;i++)
scanf("%d %s",&b[i].m,b[i].au);
for(i=0;i<m;i++)
for(j=0;b[i].au[j]!='\0';j++)
n[b[i].au[j]-65]++;
for(i=1;i<26;i++)
if(n[M]<n[i]) M=i;
printf("%c\n%d",M+65,n[M]);
for(i=0;i<m;i++)
for(j=0;b[i].au[j]!='\0';j++)
if(b[i].au[j]==M+65) printf("\n%d",b[i].m);
return 0;}
int main()
{
	int n,i,j,d[1000];
	char zuo[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);
	char s[1000][26],len;
	int sum[26]={0},k;
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&d[i],s[i]);
		len=strlen(s[i]);
		for(j=0;j<len;j++)
		{
			for(k=0;k<26;k++)
			{
				if(s[i][j]=='A'+k) sum[k]++;
			}
		}
	}
	int max=0,count=0;
	char maxid;
	for(i=0;i<26;i++)
	{
		if(sum[i]>max)
		{
			max=sum[i];
		    maxid=i+'A';
		}
	}
	printf("%c\n%d\n",maxid,max);
	int t[1000];
	for(i=0;i<n;i++)
	{
		len=strlen(s[i]);
		for(j=0;j<len;j++)
		{
			if(s[i][j]==maxid)
			{
				count++;
				t[count]=d[i];
			}
		}
	}
	for(i=1;i<=count;i++) printf("%d\n",t[i]);
	return 0;
}
struct book
{	int id;
	char aut[26];
};

int main()
{
	int m,n,i,j,k;
	int a[27]={0};
	struct book cal[1001];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&cal[i].id,cal[i].aut);
	}
	for(j=65;j<91;j++)
	{	for(i=0;i<m;i++)
		{	for(k=0;k<27;k++)
			{	if(cal[i].aut[k]==j)
					a[j-65]++;
			}
		}
	}
	int max=0,t;
	for(i=0;i<26;i++)
	{
		if(a[i]>max)
		{ max=a[i];
		  t=i;
		}
	}

	printf("%c\n%d\n",t+65,max);
	for(i=0;i<m;i++)
	{
		for(j=0;j<26;j++)
		{
			if(cal[i].aut[j]==t+65) 
				printf("%d\n",cal[i].id);
		}
	}
	return 0;
}
struct book
{
	int id;
	char s[26];
}a[100];
int main()
{
	int m,i,n,j,k,max,maxnum;
	int aut1[26]={0},aut2[26][100]={0};
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d",&a[i].id);
		gets(a[i].s);
		n=strlen(a[i].s);
		for(j=0;j<n;j++)
		{
			k=a[i].s[j]-'A';
			aut2[k][aut1[k]]=a[i].id;
            aut1[k]++;
		}
	}
    max=0;maxnum=0;
	for(i=0;i<26;i++)
	{
		if(aut1[i]>max)
		{
			max=aut1[i];
			maxnum=i;
		}
	}
	printf("%c\n",'A'+maxnum);
	printf("%d\n",max);
	printf("%d",aut2[maxnum][0]);
	for(i=1;i<max;i++)
	{
		printf("\n%d",aut2[maxnum][i]);
	}
}
struct student
{
	long num;
	char str[27];
	struct student *next;
};
int n;
struct student *creat(int m)
{
	struct student *head;
	struct student *p1,*p2;
	n=0;
	p1=p2=(struct student*)malloc(LEN);
	scanf("%ld %s",&p1->num,p1->str);
	head=0;
	while(p1->num!=0)
	{
		n=n+1;
		if(n==1)head=p1;
		else p2->next=p1;
		p2=p1;
		p1=(struct student *)malloc(LEN);
		scanf("%d %s",&p1->num,p1->str);
	}
	p2->next=0;
	return(head);
}
void main()
{
	struct student *head,*p,stu;
	int m,i,t,max,y=1,a[100]={0},sum[27]={0};
	char x=1,c;
	scanf("%d",&m);
	head=creat(m);
	p=head;
	for(;p!=0;p=p->next)
	{
		for(t=0;t<strlen(p->str);t++)
		{
			c=p->str[t];
			sum[c-64]++;
		}
	}
	max=sum[1];
	for(i=1;i<=26;i++)
		if(sum[i]>max){max=sum[i];x=i;}
		for(p=head;p!=0;p=p->next)
		{
			for(t=0;t<=strlen(p->str);t++)
				if(p->str[t]==x+64)a[y]=p->num;
				y++;
		}
		printf("%c\n%d\n",x+64,max);
		for(y=1;y<=99;y++)
			if(a[y]!=0)printf("%d\n",a[y]);
}
void main()
{
	struct shu
	{
		int bian;
		char name[26];
	};

	struct shu a[1000];
	int n,i,j,l[1000],b[26]={0},most,good,k;

	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d%s",&a[i].bian,a[i].name);
	for(i=0;i<n;i++)
		l[i]=strlen(a[i].name);

	for(i=0;i<n;i++)
		for(j=0;j<l[i];j++)
			for(k=0;k<26;k++)
				if(a[i].name[j]==65+k)
					b[k]++;

				most=b[0];
				for(i=0;i<26;i++)
					if(b[i]>most)
					{
						most=b[i];
						good=i;
					}
					printf("%c\n",65+good);
					printf("%d\n",most);

					
					for(i=0;i<n;i++)
						for(j=0;j<26;j++)
							if(a[i].name[j]==65+good)
								printf("%d\n",a[i].bian);
}
void main()
{
int a[999],m,i,j,c[26],max=0,d,k;
scanf("%d\n",&m);
for(k=0;k<26;k++)
{
c[k]=0;
}
struct books
{
int num;
char name[26];
}
books[999];
for(i=0;i<m;i++)
{
scanf("%d %s",&books[i].num,books[i].name);
}
for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
c[books[i].name[j]-'A']++;
}
}
for(k=0;k<26;k++)
{
if(c[k]>max)
{
	max=c[k];
	d=k;
}
}
printf("%c\n%d\n",d+'A',max);

for(i=0;i<m;i++)
{
for(j=0;j<strlen(books[i].name);j++)
{
if(books[i].name[j]==d+'A')
{
	printf("%d\n",books[i].num);
	break;
}
}
}
}
void main()
{
	int	m,t,len,a[26][MAX]={0},n[26]={0},max=0,num;
	int i,j;
	char s[27];

	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d %s",&t,s);
		len=strlen(s);
		for(j=0;j<len;j++){
			n[s[j]-65]++;
			a[s[j]-65][i]=t;
		}
	}

	for(j=0;j<26;j++){
		if(n[j]>max){
			max=n[j];
			num=j;
		}
	}

	printf("%c\n%d\n",num+65,n[num]);

	for(i=0;i<m;i++){
		if(a[num][i]!=0)
			printf("%d\n",a[num][i]);
	}
}
int main()
{
    int m,i,j,x,maxnumber;
    scanf("%d",&m);
    int booknum[1000];
    char k[1000][30]; 
    int author[27]={0};
    for(i=1;i<=m;i++)
    {
		scanf("%d %s",&booknum[i],k[i]);
		for(j=0;k[i][j]!='\0';j++)
		{
			author[k[i][j]-'A'+1]++;
		}
    }
    int max=0;
    for(i=1;i<=26;i++)
    {
		if(author[i]>max)
		{
			max=author[i];
			maxnumber=i;
		}
    } 
    char who;
    who='A'+maxnumber-1 ;
    printf("%c\n",who);
    printf("%d\n",max);
    for(i=1;i<=m;i++)
    {
                     for(j=0;j<strlen(k[i]);j++)
                     if(k[i][j]==who)
                     printf("%d\n",booknum[i]);
    }
    return 0; 
}
struct book
{
	int a;
	char b[30];
	struct book *next;
};
void main()
{
	int m,i,j,k,mid,l=0;
	int d[26],e[26];
	char c[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	struct book *head,*p1,*p2;
	scanf("%d",&m);
	head=p1=p2=(struct book *)malloc(LEN);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&p1->a,p1->b);
		p1=(struct book *)malloc(LEN);
		p2->next=p1;
		p2=p1;
	}
	p1=head;
	for(j=0;j<26;j++)
	{
		p1=head;
		l=0;
		for(i=0;i<m;i++)
		{
			for(k=0;k<strlen(p1->b);k++)
			{
				if(p1->b[k]==c[j])l++;
			}
			d[j]=l;e[j]=l;
			p1=p1->next;
		}
	}
	for(i=0;i<25;i++)
	for(j=0;j<25-i;j++)
	{
		if(d[j]<d[j+1])
		{
		    mid=d[j];d[j]=d[j+1];d[j+1]=mid;
		}
    }
    for(i=0;i<26;i++)
    {
    if(e[i]==d[0])break;
    }
    printf("%c\n",c[i]);
    printf("%d\n",d[0]);
    p1=head;
    for(j=0;j<m;j++)
    {
    	for(k=0;k<strlen(p1->b);k++)
    	{
    		if(p1->b[k]==c[i])printf("%d\n",p1->a);
    	}
    	p1=p1->next;
    }
    
    	
		
		
		
}
char zimu[28]="ABCDEFGJIJKLMNOPQRSTUVWXYZ";
	char writer[10000][10000];
	int times[26],id[1000],i,len[10000],book=0;
	int n,j,k,tmax,max=0;

int main()
{
	
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d%s",&id[i],&writer[i]);
		len[i]=strlen(writer[i]);
	}
	for(i=0;i<26;i++)
	{
		times[i]=0;
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			for(k=0;k<26;k++)
			{

				if(writer[i][j]==zimu[k])
				{times[k]++;}
			}
		}

	}
	for(i=0;i<26;i++)
	{
		if(times[i]>max)
	{	max=times[i];
		tmax=i;
	}}
	printf("%c\n",zimu[tmax]);
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			if(writer[i][j]==zimu[tmax])
			{book++;}
		}
	}
	printf("%d\n",book);
	for(i=0;i<n;i++)
	{
		for(j=0;j<len[i];j++)
		{
			if(writer[i][j]==zimu[tmax])
			{printf("%d\n",id[i]);}
		}
	}


	return 0;
}
struct book
{ char name[20];
  int num;
  struct book *next;
};

  struct book *creat(int m)
  {
	  int i;
	  struct book *head,*p1,*p2;
	  p1=(struct book *)malloc(len);
	  scanf("%d",&p1->num);
	  scanf("%s",p1->name);
	  p1->next=null;
	  head=p1;
	  p2=p1;
	  for(i=1;i<m;i++)
	  {
		  p1=(struct book *)malloc(len);
		  scanf("%d",&p1->num);
	      scanf("%s",p1->name);
		  p1->next=null;
		  p2->next=p1;
		  p2=p1;
	  }
	  return(head);
  }

  void main()
  {

  struct book *p,*head;
  int i,a[26],m;
  char *q;
  scanf("%d",&m);
  head=creat(m);
  p=head;
  char s[30];
  for(i=0;i<26;i++)
  a[i]=0;
  while(p){
	  

	  i=0;
	   strcpy(s,p->name);
	   while(s[i]!='\0')
	   {
		   a[s[i]-'A']++;
           i++;
	   }
	  p=p->next;
  }
 /* for(i=0;i<26;i++)
  printf("%d",a[i]);*/
  //??
  
  int max=0,max_p;
   for(i=0;i<26;i++)
	  {
	   if(a[i]>max) {max=a[i];max_p=i+'A';}
   }
   printf("%c\n%d\n",max_p,max);
   //find max
   
   p=head;
   int x=0;
   char c[20];
   while(p){
	  
	  i=0;
	   strcpy(c,p->name);
	   while(c[i]!='\0')
	   {
		   
           if(c[i]==max_p) x=1;
		   i++;
	   }
	   if(x==1) printf("%d\n",p->num);
	   x=0;
	  p=p->next;
		  //if(strchr(p->name,max_p)) printf("%d\n",p->num);
	  }
   //??

  }
void main()
{
	char a[1000][100];
	int b[1000],c[27],s[1000],max,i,j,k;
	int n;
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%d %s",&b[i],a[i]);
		s[i]=strlen(a[i]);
	}
	for (j=0;j<26;j++)
	{
		c[j]=0;
		for (i=0;i<n;i++)
		{
			for (k=0;k<s[i];k++)
			{
				if (a[i][k]==65+j)
					c[j]=c[j]+1;
			}
		}
	}
	max=0;
	for (i=0;i<26;i++)
	{
		if (c[i]>max)
			max=c[i];
	}
	for (i=0;i<26;i++)
	{
		if (c[i]==max)
		{
			printf("%c\n",i+65);
			printf("%d\n",c[i]);
			for (k=0;k<n;k++)
			{
				for (j=0;j<s[k];j++)
				{
					if (a[k][j]==65+i)
						printf("%d\n",b[k]);
				}
			}
		}
	}

}
struct inf
{
	int num;
	char wri[27];
	struct inf *next;
};

void main()
{
	int n,i,time[26]={0};
	//for(i=0;i<26;i++)
//	printf("%d",time[i]);
	char *pn;
	struct inf *head,*p1,*p0,*p;
	scanf("%d",&n);
	p1 = head = (struct inf*)malloc(sizeof(struct inf));
	for (i=0;i<n;i++)
	{
	    p0 = (struct inf*)malloc(sizeof(struct inf));
		scanf("%d%s",&p0->num,p0->wri);
		p0->next = NULL;
		p1->next=p0;
		p1=p0;
		pn=p0->wri;
		while(*pn!='\0')
		{
			time[*pn-65]++;
		    pn=pn+1;
		}
	}

	int max=0,k;
	for (i=0;i<26;i++)
	{
		if (time[i]>max)
		{
			max=time[i];
			k=i;
		}
	}
	printf("%c\n%d\n",k+65,max);
	p=head;
	while(p!=NULL)
	{
		
		pn=p->wri;
		while(*pn!='\0')
		{
			if (*pn==k+65)
			{
				printf("%d\n",p->num);
				break;
			}
			pn=pn+1;
		}	
		p=p->next;
	}
	

//	printf("%d",p->num);


}
void main()
{
	int m,i,j,temp,max;
	char a[1000][10],b[1000][20],w;
	int c[26];
	scanf("%d",&m);
	for(i=0;i<26;i++)   c[i]=0;
	for(i=0;i<m;i++)
	{
		scanf("%s %s",a[i],b[i]);
	}
	for(i=0;i<m;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++)
	{	temp=0;
		for(j=0;j<26;j++)
		{
			if(c[i]>=c[j])
			{
				temp++;
			}
		}
		if(temp==26)  {max=i;break;}
	}
	w='A'+i;
	printf("%c\n",w);
	printf("%d\n",c[i]);
	for(i=0;i<m;i++)
	{	
		for(j=0;j<strlen(b[i]);j++)
		{
			if(b[i][j]==w)   {printf("%s\n",a[i]);break;}
		}
	}

}
struct student
{
	int num;
	char name[20];
	struct student* next;
};
struct student*creat(int n)
	{
		struct student*p1,*p2,*head;
		int i;
		p1=p2=(struct student*)malloc(len);
		head=NULL;
		i=0;
		while(i<n)
		{
			scanf("%d %s",&p1->num, p1->name);
			i=i+1;
			if(i==1) head=p1;
			else p2->next=p1;
			p2=p1;
			p1=(struct student *)malloc(len);
		}
		p2->next=NULL;
		return head;
	}
void main()
{
	int i;
	struct student *head,*p;
	int n;
	scanf("%d",&n);
	head=creat(n);
	p=head;
	int a[26];
	for (i=0; i<26; i++)
	{
		a[i]=0;
	}
	while (p!=NULL)
	{
		for (i=0;i<20;i++)
		{
			a[(int)p->name[i]-'A']++;
		}
		p = p->next;
	}
	int number, max = 0;
	for (i=0; i<26; i++)
	{
		if (a[i] > max)
		{
			max = a[i];
			number = i;
		}
	}
	printf ("%c\n", 'A'+number);
	printf ("%d\n", max);
	p = head;
	while (p!=NULL)
	{
		for (i=0;i<20;i++)
		{
			if (p->name[i] == 'A'+number)
				break;
		}
		if (p->name[i] == 'A'+number) 
		printf ("%d\n", p->num);
		p = p->next;
	}
}
struct book
{
	int mark;
	char name[26];
};
int main()
{
    int m,h,i,j,k,max,length;
	int t[26];
	char a;
	scanf("%d",&m);
    struct book book[1000];
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&book[i].mark,book[i].name);
	}
	for(i=0;i<26;i++)
	{
	    a='A'+i;
		t[i]=0;
		for(j=0;j<m;j++)
		{
		    length=strlen(book[i].name);

			for(h=0;h<26;h++)
			if(a==book[j].name[h])
			{
			    t[i]++;

			}

		}
	}
	max=0;
	for(i=0;i<26;i++)
	{
		if(t[i]>max)
		{
			max=t[i];
			k=i;
		}
	}
	a='A'+k;
	printf("%c\n%d\n",a,t[k]);
	for(i=0;i<m;i++)
	{
		length=strlen(book[i].name);
		for(j=0;j<26;j++)
		{
			if('A'+k==book[i].name[j])
				printf("%d\n",book[i].mark);
		}
	}
    return 0;
}
struct
	{
		char z[30];
		int n;
	}s[1000];
struct
	{
		int name;
		int nb,b[1000],k;
	}r[93];

int main()
{
	int m,i,j,l,q;
	
	for(i=65;i<=90;i++)
	{
		r[i].name=i;
		r[i].k=1;
	}

	scanf("%d",&m);

	for(i=1;i<=m;i++)
	{
		scanf("%d %s",&s[i].n,s[i].z);
		l=strlen(s[i].z);
		for(j=0;j<l;j++)
		{
			q=s[i].z[j];
			r[q].nb++;
			r[q].b[r[q].k]=s[i].n;
			r[q].k++;
		}
	}
	
	for(i=65;i<90;i++)
		for (j=90;j>i;j--)
			if (r[j].nb>r[j-1].nb)
			{
				r[92]=r[j];
				r[j]=r[j-1];
				r[j-1]=r[92];
			}
	printf("%c\n%d\n",r[65].name,r[65].nb);
	
	
	for (i=1;i<=r[65].nb;i++)
		printf("%d\n",r[65].b[i]);
}
int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	struct{
		int a;
		char s[26];
	}zuozhe[1000];
	int i, k;
	for(i=0;i<n;i++){
		scanf("%d %s",&zuozhe[i].a, zuozhe[i].s);
	}
	int c[26]={0}, d;
	for(i=0;i<n;i++){
		d=strlen(zuozhe[i].s);
		for(k=0;k<d;k++){
			c[zuozhe[i].s[k]-65]++;
		}
	}
	int f;
	for(i=1;i<26;i++){
		if(c[i]>c[0]){
			f=i;
			d=c[i];
			c[i]=c[0];
			c[0]=d;
		}
	}
	printf("%c\n%d\n",f+65, c[0]);
	for(i=0;i<n;i++){
		d=strlen(zuozhe[i].s);
		for(k=0;k<d;k++){
			if(zuozhe[i].s[k]==f+65)
				printf("%d\n",zuozhe[i].a);
		}
	}
	return 0;
}
int main()
{
    int n;
    int i, j;
    int book_number[26];
    int max = 0;
    int max_n;
    int author_len;
    
    
    struct data
    {
           int number;
           char author[27];
    }input[1000];
    
    scanf("%d", &n);

    for(j = 0; j <= 25; j++)
          book_number[j] = 0;
    
    for(i = 0; i <= n - 1; i++)
    {
          scanf("%d %s", &input[i].number, input[i].author);
          author_len = strlen(input[i].author);
          
          for(j = 0; j <= author_len - 1; j++)
                book_number[input[i].author[j] - 'A']++;
    }
    
    for(j = 0; j <= 25; j++)
    {
          if(book_number[j] > max)
          {
                            max = book_number[j];
                            max_n = j;
          }
    }
    
    printf("%c\n%d\n", max_n + 'A', max);
    
    for(i = 0; i <= n - 1; i++)
    {
          author_len = strlen(input[i].author);
          
          for(j = 0; j <= author_len - 1; j++)
          {
                if(input[i].author[j] == max_n + 'A')
                {
                                      printf("%d\n", input[i].number);
                                      break;
                }
          }
    }
    return 0;
}