semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int ys(int x,int min){
    int r=1;
    if(x<min)
    return 0;
    for(int i=min;i<x;i++){
            if(x%i==0)
              r+=ys(x/i,i);
            }
    return r;
}
int main(){
    int n,a[1000];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            scanf("%d",&a[i]);
            }
    for(int i=0;i<n;i++){
            printf("%d\n",ys(a[i],2));
            }
    return 0;
}
int cal(int,int);
int main ()
{
    //???? 
    int n=0;
    cin>>n;
    //?????? 
    for (int i=0;i<n;i++)
    {
        int m=0;
        cin>>m;
        //?2?????????????? 
        cout<<cal(m,2)<<endl;
    }
    
    return 0;
}
//???????1??????????2????????? 
int cal (int m,int i)
{
    int count=0;
    if (m==1) return 1;//???1?????????1??? 
    for (i;i<=m;i++)//??i????????????? 
    {
        
        if (m%i==0)
        {
              count+=cal(m/i,i); 
        }
    }
    //????? 
    return count;
}
int t=0,ways;  //??????t?ways
void divide(int x,int h)
{
	int i;
	if(x==1)  //??x==1
	{t++;ways=t;}  //t+1?ways?????t
	else
		for(i=h;i<=x;i++)
			if(x%i==0)
				{h=i;
				divide(x/h,h);  //h?????????????divide?????????
				}
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{cin>>a[i];
	t=0;divide(a[i],2);
	cout<<ways<<endl;}
	return 0;
}
int sum=0;
int main()
{
	void yinshu(int,int);//????????????????????????
	int i,n,a;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		sum=0;
		cin>>a;
		yinshu(a,2);
		cout<<sum<<endl;
	}
	return 0;
}

void yinshu(int a,int x)
{
	if(a!=1)
	{
	for(int i=x;i<=a;i++)//?x?????
		if(a%i==0)//????
			yinshu(a/i,i);//?a/i??????????????i???
	}
	if(a==1)//????????????
		sum++;
}
int fenjie(int n,int min)
{int i,a=0,x=0;
for(i=2;i<=n;i++)
if(n%i==0)
a=a+1;
	if(n==1)
	return 1;
	else
	{
		for(i=min;i<=n;i++)
		{
			if(n%i==0)
			x=x+fenjie(n/i,i);
		}
		return x;
	}
}
main()
{
	int t,j,num;
	scanf("%d",&t);
	for(j=1;j<=t;j++)
	{
		scanf("%d",&num);
		printf("%d\n",fenjie(num,2));}
}
int num = 1, i, factor;

void f(int factor, int x)
{
	for (; factor * factor <= x; factor++)
	{
		if (x % factor == 0)
		{
			num++;
			f(factor, x / factor);
		}
	}
}

int main()
{
	int a, n;
	cin >> n;
	while(n--)
	{
		cin >> a;
		f(2, a);
		cout << num << endl;
		num = 1;
	}

	return 0;
}
int varieties=0,p;
int dfs(int dep,int last,int k)    //???????????k????? ?? 
{
    if (k == 1)              //??k=1 
    {
        varieties++;            //???+1 
        return 0;
    }
    for (int i = last; i <= k; i++)      
    if (k % i == 0)                    //??k??i????????????k=1 
    {
        dfs(dep+1,i,k/i);
    }
}
int main()
{
    int i,n,t;
    cin>>n;            //?????? 
    int m[n];          //????n???????? 
    for(i=0;i<n;i++)
    {
        cin>>t;            
        dfs(0,2,t);
        m[i]=varieties;
        varieties=0;
    }
    for(i=0;i<n;i++)
    cout<<m[i]<<endl;      //??????????? 
    return 0;
}
/*
 * part.cpp
 *
 *  Created on: 2012-11-25
 *      Author: Lsj
 */

int disintegerate(int a, int b)//?????a????
{
	if (a == b || b == 1)//a b????b=1??????
		return 1;
	if (a > b)//a??b?b???1????0???0
		return 0;
	int ans = 0;//ans???
	for (int i = a; i <= b; i++)//?a?b??
	{
		if (b % i == 0)//b??????
			ans = ans + disintegerate(i, b / i);//??????
	}
	return ans;//??ans
}

int main()//main??
{
	int Time;
	cin >> Time;//????
	while (Time > 0) {
		int n;
		cin >> n;//??n
		cout << disintegerate(2, n) << endl;//????
		Time--;//Time?1
	}

	return 0;
}//??
int Fz(int,int);
int main()
{
    int n,num[1000];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
       num[i]=Fz(a,2);
    }   
for(int i=0;i<n;i++){
	cout<<num[i]<<endl;
}
    return 0;
}
int Fz(int x,int m)
{
    int s=1,i;
    int y=(int)sqrt((double)x);
    for(i=m;i<=y;i++)
    {
        if(x%i==0)
        {
        s=s+Fz(x/i,i);
        }
    }  
    return s;
}
int main(){
	int number(int n, int low);
	int n, i, data, ans;
	scanf("%d", &n);
	for (i=1; i<=n; i++)
	{
		scanf("%d", &data);
		ans = number(data, 2);
		printf("%d\n", ans);
	}
}
int number(int n, int low)
{
	int j, ans;
	ans = 0;
	for (j = low ; j * j<= n; j++)
	{
		if (n % j == 0) 
			ans = ans + number(n / j, j);
	}
	ans = ans + 1;
	return ans;
}
struct wr
{ char w;
  int k;
  int num[1000];
  struct wr* next;  
};

struct wr * creat(void)
{
	struct wr *head,*p1,*p2,a;
	char i;
	head=p2=(struct wr *)malloc(sizeof(struct wr));
	head->w='A';
	head->k=0;
	for(i='B';i<='Z';i++)
	{
		p1=(struct wr *)malloc(sizeof(struct wr));
        p1->w=i;
		p1->k=0;
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return head;
}

void add(char a,int b,struct wr * head)
{
	struct wr *p;
	for(p=head;p!=NULL;p=p->next)
	if(a==p->w)
	{(p->k)++;
	  *(p->num+p->k-1)=b;
	}
}

void max(struct wr * head)
{ 
	struct wr *p1,t;
	for(p1=head->next;p1!=NULL;p1=p1->next)
		 if(p1->k>head->k)
		 *head=*p1;
}

void main()
{
	struct wr *head,*t;
	int n,*no,i;
	char *ws,*p;
	ws=(char *)malloc(sizeof(char)*27);
	head=creat();
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&no);
		gets(ws);
		for(p=ws;*p!='\0';p++)
			add(*p,no,head);
	}
    max(head);
	printf("%c\n",head->w);
	printf("%d\n",head->k);
	for(i=0;i<head->k;i++)
		printf("%d\n",*(head->num+i));
	
}
struct score
{
	char id[10];
	char name[26];
}book[1000];
int main()
{
	int i,j,k,n,num,max=0;
	char maxname;
	scanf("%d",&num);
	for(i=0;i<num;i++){
		scanf("%s",book[i].id);
		scanf("%s",book[i].name);
	}
	for(i=0;i<26;i++){
		n=0;
		for(j=0;j<num;j++){
			for(k=0;k<26;k++){
				if(book[j].name[k]==('A'+i))n+=1;
			}
		}
		if(n>max){
			maxname='A'+i;
			max=n;
		}
	}
	printf("%c\n%d\n",maxname,max);
	for(j=0;j<num;j++){
		for(k=0;k<26;k++){
			if(book[j].name[k]==maxname)printf("%s\n",book[j].id);;
		}
	}
	return 0;
}
int main()
{
	int n, i,l,j,t,k[30][99],a[30],o,q,max=0,maxman;
	for(i=0;i<30;i++)
		a[i]=0;
	char s[40];
	scanf("%d", &n);
	for(j=0; j<n; j++)
	{
		scanf("%d %s",&o,s);
		l=strlen(s);
		for(i=0; i<l; i++)
		{
			q = s[i]-'A';
			a[q]++;
			t=a[q];
			k[q][t]=o;
		}
	}
	for(i='A'-'A';i<='Z'-'A';i++)
	{
		if(a[i]>max)
		{
//		printf("%d,%d\n",a[i],i);
			max = a[i];
		maxman = i;
		}
	}
	printf("%c\n%d\n",maxman+'A',max);
	for(i=1;i<=max;i++)

	printf("%d\n",k[maxman][i]);


	return 0;
}
int main()
{
	int n;
	cin>>n;
	int a[26],max,num[n],i,j,s;
	char maxname,name[n][10];
	memset(a,0,sizeof(a));
	for(i=0;i<n;i++)
	{
		cin>>num[i]>>name[i];
		s=strlen(name[i]);
		for(j=0;j<s;j++)
			a[name[i][j]-'A']++;
	}
	max=a[0],maxname='A';
	for(i=1;i<26;i++)
		if(a[i]>max)
		{
			max=a[i],maxname='A'+i;
		}
	cout<<maxname<<endl<<max<<endl;
	for(i=0;i<n;i++)
	{
		s=strlen(name[i]);
		for(j=0;j<s;j++)
			if(name[i][j]==maxname)
				cout<<num[i]<<endl;
	}
	return 0;
}
int pro(char pr)
{
     return toupper(pr) - 'A';
}

void put_names(int name[26][100], int books[26], int booknum);
int max(int books[26]);


main()
{
      int n, i, name[26][100],  books[26] = {0}, max_ptr;
      int booknum;
      
      scanf("%d", &n);
      
      for(i = 1;i <= n;i ++)
      {
            scanf("%d", &booknum);
            put_names(name, books, booknum);
            
      }
      
      max_ptr = max(books);
      printf("%c\n", max_ptr + 'A');
      printf("%d\n", books[max_ptr]);
      
      for(i = 1;i <= books[max_ptr];i ++)
      {
            printf("%d\n", name[max_ptr][i]);
      }
}

void put_names(int name[26][100], int books[26], int booknum)
{
     char ch;
     int ptr;
     int counter = 0;
     while(1)
     {
             ch = getchar();
             if(ch != ' ') break;
     }

     

     

     while(1)
     {

               
               ptr = pro(ch);
               books[ptr] ++;
               //printf("|%c, %d|---", ch, books[ptr]);
               

               name[ptr][books[ptr]] = booknum;
               ch = getchar();
               if(ch == '\n') break;

     }
     //printf("[%d]\n", counter);
}

int max(int books[26])
{
    int i;
    int ptr;
    ptr = books[0];
    for(i = 0;i <= 25;i ++)
    {
          if(books[i] > books[ptr]) ptr = i;
    }
    return ptr;
}
struct book
{
int num;
char name[25];
}book[999];
void main()
{
	int m,i,j,k,b,c,max=0,a[25]={0},q[25][999]={0},p=0;
scanf("%d",&m);
for (i=0;i<m;i++)
{
	scanf("%d %s",&book[i].num,book[i].name);
	b=strlen(book[i].name);
	for(j=0;j<b;j++)
	{
		for(k=0;k<26;k++)
		{
			if (book[i].name[j]==k+65)
			{
				a[k]=a[k]+1;
				q[k][i]=book[i].num;
			}	
		}
	}
}

for (i=0;i<25;i++)
{
if(a[i]>max)
{
max=a[i];
c=i;
}
}
printf("%c\n%d\n",c+65,max);
for (i=0;i<m;i++)
{
if(q[c][i]>0)
printf("%d\n",q[c][i]);
}




}
//????????????
//???2013.12.21
//****************************
int main()
{
	int n=0,i=0,j=0,num[100],k=0,count[26]={0},max=0;
	char nam[100][30]={NULL};
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>num[i];
		cin.get();
		gets(nam[i]);
		for(j=0;j<strlen(nam[i]);j++)
			count[nam[i][j]-'A']++;
	}
	max=count[0];
	for(i=0;i<26;i++)
	{
		if(max<count[i])
		{    max=count[i];k=i;   }
		else
			continue;
	}
	j=0;
	cout<<(char)(k+'A')<<endl;
	cout<<max<<endl;
	for(i=0;i<n;i++)
		for(j=0;;j++)
		{
			if(nam[i][j]==k+'A')
			{	cout<<num[i]<<endl;break;   }
			if(nam[i][j]==NULL)
				break;
		}

	return 0;
}
void main()
{
	int i,j,m,a[26][999],num[26]={0},t,max;
	char zz[27];
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&t,zz);
		for(j=0;j<strlen(zz);j++)
		{
			a[(int)(zz[j]-'A')][num[(int)(zz[j]-'A')]]=t;
			num[(int)(zz[j]-'A')]++;
		}
	}
	max=0;
	for(i=0;i<26;i++)
	{
		if(num[i]>num[max])
			max=i;
	}
	printf("%c\n%d\n",max+'A',num[max]);
	for(i=0;i<num[max];i++)
		printf("%d\n",a[max][i]);

}
//****************************************
//*???????                       **
//*?????? 1100012763              **
//*???2011.11.14                     **
//****************************************
int main() 
{
	int n , number , i , j , k , t , len , max;
	int map[26][1000] = {0};
	char name[27];

	cin >> n;
	for (i = 0; i <= 25; i++)
		map[i][0] = 0;
	for (i = 1; i <= n; i++)
	{
		cin >> number >> name;
        len = strlen(name);
		for (j = 0; j <= len - 1; j++)
		{
			k = name[j] - 'A';
            map[k][0]++;
			t = map[k][0];
			map[k][t] = number;
		}
	}
	max = 0;
	for (i = 0; i <= 25; i++)
	{
		if (map[i][0] > max)
		{
			max = map[i][0];
			k = i;
		}
	}
	cout << (char)(65 + k) << endl;
	cout << map[k][0];
	for (i = 1; i <= map[k][0]; i++)
		cout << endl << map[k][i];
	
	return 0;
}
struct book
{
	int code;
	char writer[10];
};
void main()
{
	int n,i,j,t=0,d,ww[27]={0};
	char max,w[27];
	struct book list[999];
	scanf("%d",&n);
	for(i=0;i<26;i++)w[i]=i+65;
	for(i=0;i<n;i++)
		scanf("%d %s",&list[i].code,list[i].writer);
   for(i=0;i<n;i++)
	   for(j=0;list[i].writer[j]!='\0';j++)
       {
		   for(d=0;d<26;d++)
			   if(list[i].writer[j]==w[d])ww[d]++;
	   }	   
	   max=ww[0];
	for(i=0;i<26;i++)
	if(ww[i]>max)
	{
		max=ww[i];
		t=i;
	}
	printf("%c\n%d\n",w[t],ww[t]);

for(i=0;i<n;i++)
	   for(j=0;list[i].writer[j]!='\0';j++)
       {
		   
			   if(list[i].writer[j]==w[t])printf("%d\n",list[i].code);
	   }	   
}
struct worker
{
	int name;
	char au[20];
	struct worker *next;
};
struct help
{
	char author;
	int  max;
};
struct worker*creat(int m)
{
	struct worker*p1,*p2,*p;
	int i;
	p1=p2=(struct worker *)malloc(sizeof(struct worker));
	
	scanf("%d %s",&p1->name,p1->au);
	p=p1;
	for(i=0;i<m-1;i++)
	{
		p1=(struct worker *)malloc(sizeof(struct worker));
		scanf("%d %s",&p1->name,p1->au);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return p;
}
void print(struct worker *p)
{
	struct worker *p1;
	p1=p;
	while(p1!=NULL)
	{
		printf("%d %s\n",p1->name,p1->au);
		p1=p1->next;
	}
}
void most(struct worker *p)
{
	struct worker *p1,*p2;
	int a[30]={0},i,max;
	char author;
	struct help t;
	p1=p;
	p2=p;
	while(p1!=NULL)
	{
		for(i=0;*(p1->au+i)!='\0';i++)
		{
			a[*(p1->au+i)-65]=a[*(p1->au+i)-65]+1;
		}
		p1=p1->next;
	}
	for(i=0,max=0;i<26;i++)
	{
		if(a[i]>max) max=a[i];
	}
	for(i=0;i<26;i++)
	{
		if(a[i]==max) author=i+65;
	}
	printf("%c\n%d\n",author,max);
    p1=p;
	while(p1!=NULL)
	{
		for(i=0;*(p1->au+i)!='\0';i++)
		{
			if(*(p1->au+i)==author) printf("%d\n",p1->name);
		}
		p1=p1->next;
	}
}
void main()
{
	struct worker *p1,*p;
	struct help t;
	int m;
	char c;
	scanf("%d",&m);
	p=creat(m);
	p1=p;
	//print(p1);
	most(p1);
}
struct 
{
	char name[20];
	int num;
}book[1000];

int main()
{
	int n,i,j,max=0,m=0;
	scanf("%d",&n);
	int c[26]={0};
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&book[i].num,book[i].name);
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<26;j++)
		{
			strchr(book[i].name,'A'+j)?c[j]++:0;
		}
	}
	for(j=0;j<26;j++)
	{
		if(c[j]>max)
		{
			max=c[j];
			m=j;
		}
	}
	printf("%c\n%d\n",'A'+m,c[m]);
	for(i=0;i<n;i++)
	{
		strchr(book[i].name,'A'+m)?printf("%d\n",book[i].num):0;
	}
	return 0;
}
void main()
{
	struct book
	{
		int x;
		char z[10];
		struct book *next;
	}*p1,*p2,*p,*head,*t;
	int i,n,max=0,j,k,l,y[400],q;char u;scanf("%d",&n);
p1=p2=head=(struct book *)malloc(sizeof(struct book));
for(i=0;i<n;i++)
{
	scanf("%d %s",&p1->x,p1->z);y[i]=strlen(p1->z);
	p1=(struct book *)malloc(sizeof(struct book));p2->next=p1;p2=p1;
}
p=head;
for(i=0;i<n-1;i++)
{	
for(j=0;j<y[i];j++)
{
	q=1;t=p->next;
	for(k=i+1;k<n;k++)
	{
		for(l=0;l<y[k];l++)
			if(p->z[j]==t->z[l])q++;
			t=t->next;
	}
	if(q>max){max=q;u=p->z[j];}
}
p=p->next;
}
printf("%c\n%d\n",u,max);
p=head;
for(i=0;i<n;i++)
{
	for(j=0;j<y[i];j++)
		if(u==p->z[j]){printf("%d\n",p->x);break;}
		p=p->next;
}
}
struct book
{
	int num;
	char name[26];
};
struct name
{
	char na;
	int n;
};
void main()
{
	int n,i,j,k,s,max=0;
	struct book a[1000];
	struct name b[26];
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%d%s",&a[i].num,a[i].name);
	}
	for(i=0;i<=25;i++)
	{
		b[i].na='A'+i;
		for(j=0,s=0;j<=n-1;j++)
		{
			for(k=0;k<=strlen(a[j].name)-1;k++)
			{
				if(b[i].na==a[j].name[k])
				{
					s++;
					break;
				}
			}
		}
		b[i].n=s;
	}
	for(i=0;i<=25;i++)
	{
		if(b[i].n>max)
		{
			max=b[i].n;
		}
	}
	
	for(i=0;i<=25;i++)
	{
		if(b[i].n==max)
		{
			printf("%c\n%d\n",b[i].na,b[i].n);
		for(j=0;j<=n-1;j++)
			{
				for(k=0;k<=strlen(a[j].name)-1;k++)
				{
					if(b[i].na==a[j].name[k])
					{
						printf("%d\n",a[j].num);
						break;
					}
				}
			}
		}
	}
}
struct book 
{
	int num;
	char edit[26];
	struct book *next;
};
int m;
struct book *head,*p1,*p2;

struct book *creat(void)
{
	p1=(struct book*)malloc(len);
	scanf("%d %s",&p1->num,p1->edit);
	head=p1;
	p2=p1;
	m=m-1;
	do
	{
		p1=(struct book*)malloc(len);
        scanf("%d %s",&p1->num,p1->edit);
		p1->next=NULL;
		p2->next=p1;
		p2=p1;
		m=m-1;
	}while(m);
	return(head);
}


void main()
{
    int max=0,i=0,j,k[26]={0};
	struct book *head,*p;
    scanf("%d",&m);
	head=creat();
	for(p=head;p!=NULL;)
	{
		for(i=0;p->edit[i]!=0;i++)
			k[(p->edit[i])-65]+=1;
		p=p->next;
	}
    for(i=0;i<26;i++)
		if(k[i]>max) {max=k[i];j=i;}
	printf("%c\n%d\n",j+65,max);
    for(p=head;p!=NULL;)
	{
		for(i=0;p->edit[i]!=0;i++)
			if(p->edit[i]==j+65) printf("%d\n",p->num);
		p=p->next;
	}

}
struct book
{
	int id;
	char p[26];
};
void main()
{
	int n,i,j,k,a[150]={0},flag,max=0;
	struct book t,*s,o[1000],y[1000];
	scanf("%d",&n);
	s=(struct book *)malloc(n*sizeof(struct book));
	for(i=0;i<n;i++)
	{ scanf("%d %s",&s[i].id,s[i].p);
	  for (j=0;s[i].p[j]!='\0';j++)
		  a[s[i].p[j]]++;
	  }
	for(i='A';i<='Z';i++)
		if (max<a[i]) {max=a[i];j=i;}
    printf("%c\n",j);
printf("%d\n",max);
	for(i=0;i<n;i++)
	{
		flag=0;
		for(k=0;s[i].p[k]!='\0';k++)
			if (s[i].p[k]==j)flag=1;
			if(flag==1) printf("%d\n",s[i].id);
    }
}
int main()
{
	struct book
	{
		int No;
		char author[27];
		int yes;
		struct book *next;
	};
	struct book*head,*p;
	int m,i,*max;
	int *count;
	count=(int*)malloc(26*sizeof(int));
	for(i=0;i<26;i++)
		*(count+i)=0;

	p=(struct book*)malloc(sizeof(struct book));
	head=p;
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d%s",&p->No,p->author);
		if(i==m-1) p->next=NULL;
		else p->next=(struct book*)malloc(sizeof(struct book));
		p=p->next;
	}
	
	p=head;
	while(p!=NULL)
	{
		char *point;
		point=p->author;
		while(*point!='\0')
		{
			(*(count+((*point)-65)))++;
			point++;
		}
		p=p->next;
	}

	max=count;
	for(i=0;i<26;i++)
		if(*(count+i)>*max) max=count+i;
	printf("%c\n",max-count+65);
	printf("%d\n",*max);

	p=head;
	while(p!=NULL)
	{
		char *point;
		point=p->author;
		while(*point!='\0')
		{
			if(*point==max-count+65) printf("%d\n",p->No);
			point++;
		}
		p=p->next;
	}
	return 0;
}
int main()
{
	int n,i,a[2000],max=0,t,b[30]={0},j,m;
	char str[1000][30];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %s",&a[i],str[i]);
		for(j=0;j<strlen(str[i]);j++){
			m=str[i][j]-64;
			b[m]++;
	}
	}
	for(i=1;i<26;i++)if(b[i]>max){
		max=b[i];
		t=i;
	}
	printf("%c\n%d\n",t+64,max);
	for(i=0;i<n;i++){
		for(j=0;j<strlen(str[i]);j++)
			if(str[i][j]==t+64)printf("%d\n",a[i]);
	}
	return 0;
}
void main()
{
	char s[100][30]={"\0"},c;
	int i,j,k,m,n,a[26]={0},b[100]={0},t=-1;
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{
		scanf("%d %s",&b[i],s[i]);
		for(c='A';c<='Z';c++)
		{
			if(strchr(s[i],c)) a[c-65]++;
		}
	}
	j=a[0];
	k=0;
	for(i=1;i<26;i++)
	{
		if(a[i]>j)
		{
			j=a[i];
			k=i;
		}
	}
	printf("%c\n%d\n",k+65,a[k]);
	for(i=0;i<m;i++)
			if(strchr(s[i],k+65)) printf("%d\n",b[i]);
}
int main()
{   char p=0;
	int m,i,j,max[1000];
	struct book{
		int num;
		char s[27];
	} book[1000];
	memset(max,0,sizeof(max));
	scanf("%d",&m);
	for(i=0;i<m;i++)
	{scanf("%d%s",&book[i].num,book[i].s);}
    for(i=0;i<m;i++)
	{for(j=0;book[i].s[j];j++)
	{ if(++max[book[i].s[j]]>max[p])
	p=book[i].s[j];
	}}
	printf("%c\n%d\n",p,max[p]);
	for(i=0;i<m;i++)
	{if(strchr(book[i].s,p))
	printf("%d\n",book[i].num);}

		return 0;
}
struct book
	{int num;
	 char name[27];
     struct book *next;	
	};
main()
{
	struct book *p1,*p2,*head=NULL;
    int i,j,n,m,k,a[26],max,first;
	scanf("%d",&m);
	
	for(i=0;i<m;i++)
	{
       p1=(struct book*)malloc(sizeof(struct book));
	   scanf("%d%s",&p1->num,p1->name);
	   if(i==0) head=p1;
	   else p2->next=p1;
	        p2=p1;
	}
	p2->next=NULL;
	p1=head;
	for(i=0;i<26;i++)
		a[i]=0;
	for(i=0;i<m;i++)
	{
		n=strlen(p1->name);
		for(j=0;j<n;j++)
		{k=p1->name[j]-'A';a[k]++;
		}
		p1=p1->next;
	}
	
	max=a[0];
	first=0;
	for(k=1;k<26;k++)
	{if(a[k]>max) {max=a[k];
	              first=k;}
	}
    printf("%c\n",'A'+first);
	printf("%d\n",max);

	
	p1=head;
	for(i=0;i<m;i++)
	{
		n=strlen(p1->name);
		for(j=0;j<n;j++)
		{
			if(p1->name[j]=='A'+first) {printf("%d\n",p1->num);
			                            break;}
		}
	p1=p1->next;
	}
}
struct book
{
       int num;
       char au[32];
       int sta[27];
}b[1020];
int main()
{
    int i,j,k,m,n;
    char c;
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
                    scanf("%d %s",&b[i].num,b[i].au);
    }
    for(i=0;i<m;i++)
    {
                    //scanf("%d %s",&b[i].num,&b[i].au);
                    for(j=0;;j++)
                    {
                                 c=b[i].au[j];
                                 if(c=='\0')
                                 {
                                            break;
                                 }
                                 else
                                 {
                                     b[i].sta[c-64]++;
                                 }
                    }  
    }
    int sum[27]={0};
    for(i=0;i<m;i++)
    {
                      for(j=1;j<27;j++)
                      {
                                       sum[j]+=b[i].sta[j];
                      }
    }
    int max=0;
    for(i=1;i<27;i++)
    {
                     if(sum[i]>max)
                     {
                                   max=sum[i];
                                   k=i;
                     }
    }
    printf("%c\n",k+64);
    n=0;
    for(i=0;i<m;i++)
    {
                    if(b[i].sta[k]!=0)
                    {
                                      n++;
                    }
    }
    printf("%d\n",n);
    n=0;
    for(i=0;i<m;i++)
    {
                    if(b[i].sta[k]!=0)
                    {
                                      n++;
                                      if(n==1)
                                      {
                                              printf("%d",b[i].num);
                                      }
                                      else
                                      {
                                          printf("\n%d",b[i].num);
                                      }
                    }
    }
    return 0;
}
struct tushu 
{
	int num;
	char name[20];
	struct tushu *next;
};
struct tushu *creat(int m)
{
	struct tushu *head,*p1,*p2;
	p1=p2=(struct tushu *)malloc(LEN);
	scanf("%d%s",&p1->num,p1->name);
	head=p1;
	int i;
	for(i=2;i<=m;i++)
	{
		p1=(struct tushu *)malloc(LEN);
        scanf("%d%s",&p1->num,p1->name);
		p2->next=p1;
		p2=p1;
	}
	p2->next=NULL;
	return(head);
}
int main()
{
	int m,num[26]={0},i,max;
	scanf("%d",&m);
	struct tushu *head,*p1;
	head=creat(m);
	char *x;
	for(i=0;i<26;i++)
	{
		p1=head;
		x=p1->name;
		while(p1!=NULL)
		{
			while(*x!='\0')
			{
				if(*x==(i+65))
					num[i]=num[i]+1;
				x=x+1;
			}
			p1=p1->next;
			x=p1->name;
		}
	}
	max=0;
	for(i=1;i<26;i++)
	{
		if(num[max]<num[i])
			max=i;
	}
	printf("%c\n",max+65);
	printf("%d\n",num[max]);
	p1=head;
	x=p1->name;
	while(p1!=NULL)
	{
		while(*x!='\0')
		{
			if(*x==(max+65))
			{
				printf("%d\n",p1->num);
				break;
			}
			x=x+1;
		}
		p1=p1->next;
		x=p1->name;
	}
	return 0;
}
struct book{
	int co;
	char A[26];
};

int main(){
	int m,i,k,max;
	int count[26];
	int *cc;
	scanf("%d",&m);
	struct book *bk=(struct book*)malloc(sizeof(struct book)*m);/*??????*/
	struct book *p;
	p=bk;
	for(i=0;i<m;i++,p++){
		scanf("%d %s",&(p->co),p->A);
	}
	cc=count;/*?? */
	memset(count,0,sizeof(count));/*????*/
	for(i=0;i<26;i++,cc++){
		p=bk;
		for (k=0;k<m;k++,p++)
		{
			if (strchr(p->A,'A'+i))
			{
				(*cc)++;
			}
		}/*??*/
	}
	max=0;
	for (i=0;i<26;i++)
	{
		if (count[i]>count[max])
		{
			max=i;
		}
	}
	printf("%c\n%d\n",'A'+max,count[max]);
	p=bk;
	for (i=0;i<m;i++,p++)
	{
		if (strchr(p->A,'A'+max))
		{
			printf("%d\n",p->co);
		}
	}
	free(bk);
	return 0;
}
int main()
{
    int a[999];char r[999][26];int b[125]={0};int n,i,j,maxi,s;
	scanf("%d",&n);
	for(i=0;i<=n-1;i++)
	{
		scanf("%d",&a[i]);
		scanf("%s",r[i]);
		s=strlen(r[i])-1;
		for(j=0;j<=s;j++)
		{
			b[r[i][j]]=b[r[i][j]]+1;
		}
	}
    maxi=65;
    for(i=66;i<=90;i++)
	{
		if(b[i]>b[maxi]) maxi=i;
	}
    printf("%c\n",maxi);
    printf("%d\n",b[maxi]);
	for(i=0;i<=n-1;i++)
	{
		s=strlen(r[i])-1;
		for(j=0;j<=s;j++)
		{
			if(r[i][j]==maxi)
			{
				printf("%d\n",a[i]);
				break;
			}
		}
	}

	return 0;
}
struct author
{
	int number;
	char name[26];
}
author[999];

struct single
{
	
	char letter[1];
	int number;

}
single[26];



int main(int argc, char* argv[])
{
	int n, i, m, j, p, k, book[999];
	for(i=0;i<26;i++)
	{
		single[i].letter[0]=65+i;
		single[i].number=0;
	}
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d %s",&author[i].number,&author[i].name);
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<26;j++)
		{
			for(k=0;k<26;k++)
			{
				if(single[k].letter[0]==author[i].name[j])
					single[k].number++;
			}
		}
	}
	m=0;
	p=single[0].number;
	for(i=1;i<26;i++)
	{
		if(p<single[i].number)
		{
			p=single[i].number;
			m=i;
		}
	}
	k=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<26;j++)
		{
			if(author[i].name[j]==single[m].letter[0])
			{
				book[k]=author[i].number;
				k++;
			}
		}
	}
	printf("%c\n",single[m].letter[0]);
	printf("%d\n",k);
	for(i=0;i<k;i++)
	{
		printf("%d\n",book[i]);
	}
	return 0;
}
int main(int argc, char* argv[])
{
	int s[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};
	struct book{
		int a;
        char name[27];
	};
	struct book list[999];
	char c;
	int n,i,j,b,maxnum=0,max;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d%s",&list[i].a,list[i].name);
		for(j=0;list[i].name[j]!='\0';j++){
			c=list[i].name[j];
			b=c-'A';
			s[b]++;
		}         
	}
	for(i=0;i<26;i++){
		if(s[i]>maxnum){
		maxnum=s[i];
		max=i;
		}
	}
	printf("%c\n%d\n",'A'+max,maxnum);
	for(i=0;i<n;i++){
		for(j=0;list[i].name[j]!='\0';j++){
			if(list[i].name[j]-'A'==max){
				printf("%d\n",list[i].a);
			}
		}
	}

	return 0;
}