id
int32
0
32.5k
code
stringlengths
95
8.4k
label
stringclasses
65 values
800
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]); } } }
2
801
void main() { struct tushu { int num; char zuozhe[27]; }ts[999]; int i,j,n,k,temp; int count[26]={0}; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %s",&ts[i].num,ts[i].zuozhe); for(j=0;ts[i].zuozhe[j]!='\0';j++) {count[ts[i].zuozhe[j]-65]++;} } temp=count[0]; k=0; for(i=0;i<26;i++) { if(count[i]>temp){k=i;temp=count[i];} } printf("%c\n",k+65); printf("%d\n",count[k]); for(i=0;i<n;i++) { for(j=0;ts[i].zuozhe[j]!='\0';j++) { if(ts[i].zuozhe[j]==k+65) { printf("%d\n",ts[i].num); break; } } } }
2
802
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; }
2
803
struct book { int num; char writer[26]; }; int m; int main() { int i; scanf("%d",&m); book *p; p=(struct book*)malloc(sizeof(struct book)*m); for(i=0;i<m;i++) { scanf("%d %s",&p[i].num,p[i].writer); } int j=0,u=0; int *a; a=(int *)malloc(sizeof(int)*150); for(i='A';i<='z';i++) a[i]=0; for(i='A';i<='Z';i++) { for(j=0;j<m;j++) { for(u=0;u<strlen(p[j].writer);u++) { if(i==p[j].writer[u]) { a[i]++; break; } } } } int max=0; for(i='A';i<='Z';i++) { if(max<a[i]) max=a[i]; } for(i='A';i<='Z';i++) { if(max==a[i]) break; } printf("%c\n%d\n",i,a[i]); for(j=0;j<m;j++) { for(u=0;u<strlen(p[j].writer);u++) { if(i==p[j].writer[u]) { printf("%d\n",p[j].num); break; } } } return 0; }
2
804
int main(int argc, char* argv[]) { struct { int a; char b[26]; }num[999]; int i,m,j,k; int s[26]; scanf ("%d",&m); for (i=0;i<m;i++) { scanf ("%d%s",&num[i].a,num[i].b); } for (k=0;k<26;k++) { s[k]=0; } for (i=0;i<m;i++) { for (j=0;num[i].b[j]!='\0';j++) { k=num[i].b[j]-'A'; s[k]++; } } int first=s[0]; int t; for (k=0;k<26;k++) { if (s[k]>first) { first=s[k]; t=k; } } printf ("%c\n",t+'A'); printf ("%d\n",first); for (i=0;i<m;i++) { for (j=0;num[i].b[j]!='\0';j++) { if (num[i].b[j]==(t+'A')) { printf ("%d\n",num[i].a); } } } return 0; }
2
805
struct book { int id; char str[27]; }bo[1000]; struct people { int name; int number; int book_number[1000]; }people[26]; int main ( ) { int n, i, j, k, m, max = 0; char a[27] = {'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','\0'}; cin >> n; for(i = 0;i < n;i++) { cin >> bo[i].id >> bo[i].str; } for(i = 0;i < 26;i++)//??? { people[i].number = 0; } for(i = 0;i < n;i++) { m = strlen(bo[i].str); for(j = 0;j < m;j++) { for(k = 0;k < 26;k++)//??????????? { if(bo[i].str[j] == a[k]) { people[k].book_number[people[k].number] = bo[i].id; people[k].number++; } } } } j = 0; for(i = 0;i < 26;i++)//????????? { if(people[i].number > max) { j = i; max = people[i].number; } } cout << a[j] << endl; cout << people[j].number << endl; for(i = 0;i < people[j].number;i++) { cout << people[j].book_number[i] << endl; } return 0; }
2
806
int main() { int book[1000], m, i, j, k, length, max = 0, name[500] = {0}; char writer[1000][26], name1; cin >> m; for (i = 0; i < m; i++) cin >> book[i] >> writer[i]; for (k = 'A'; k <= 'Z'; k++) { for (i = 0; i < m; i++) { length = strlen(writer[i]); for (j = 0; j < length; j++) if (writer[i][j] == k) name[k]++; } if (name[k] > max) { max = name[k]; name1 = k; } } cout << name1 << endl; cout << max << endl; for (i = 0; i <= m; i++) { length = strlen(writer[i]); for (j = 0; j <= length; j++) if (writer[i][j] == name1) cout << book[i] << endl; } return 0; }
2
807
void main() { struct book { int num; char name[26]; }; int m,i,j,max; int sum[26]={0}; scanf("%d",&m); struct book b[m]; for(i=0;i<m;i++) scanf("%d %s",&b[i].num,b[i].name); for(i=0;i<m;i++) { for(j=0;j<strlen(b[i].name);j++) sum[(b[i].name)[j]-'A']++; } max=0; for(i=1;i<26;i++) if(sum[i]>sum[max])max=i; printf("%c\n%d\n",max+'A',sum[max]); for(i=0;i<m;i++) { for(j=0;j<strlen(b[i].name);j++) { if((b[i].name)[j]==65+max) printf("%d\n",b[i].num); } } }
2
808
int main() { int n, i, j, k, f=0, c, d; struct aut { int num; char wrt[26]; }a[999]; char wr[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 g[26]={0}; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d%s",&a[i].num,a[i].wrt); c=strlen(a[i].wrt); for(j=0;j<c;j++) { for(k=0;k<26;k++) { if(a[i].wrt[j]==wr[k]) g[k]=g[k]+1; } } } for(i=0;i<26;i++) { if(f<g[i]) { f=g[i]; d=i; } } printf("%c\n%d\n",wr[d],f); for(i=0;i<n;i++) { c=strlen(a[i].wrt); for(j=0;j<c;j++) { if(a[i].wrt[j]==wr[d]) { printf("%d\n",a[i].num); break; } } } return 0; }
2
809
int main() { int n,max,t,i,j,a[1000],l,b[30]={0},c; char str[1000][20]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %s",&a[i],str[i]); l=strlen(str[i]); for(j=0;j<l;j++){ b[str[i][j]-64]++; } } for(i=1;i<27;i++){ if(b[i]>max){ max=b[i]; t=i; } } printf("%c\n%d\n",t+64,b[t]); for(i=0;i<n;i++){ l=strlen(str[i]); for(j=0;j<l;j++){ if(str[i][j]==t+64) printf("%d\n",a[i]); } } return 0; }
2
810
void main() { struct ts { int sl; char zz[30]; // int zzsl; struct ts *next; }; struct ts *p1,*p2,*head; int i,j,k,m,n,max,zzzdnum,num[100]={0}; char zzzd;//??“????”^^ scanf("%d",&n); p1=p2=head=(struct ts *)malloc(sizeof(struct ts)); scanf("%d %s",&p1->sl,p1->zz); // p1->zzsl=strlen(p1->zz);//????? for(i=1;i<n;i++) { p1=(struct ts *)malloc(sizeof(struct ts)); scanf("%d %s",&p1->sl,p1->zz); // p1->zzsl=strlen(p1->zz); p2->next=p1; p2=p1; } p1->next=0;//??NULL??????? for(i='A';i<='Z';i++) { p1=head; for(k=0;k<n;k++) { for(j=0;p1->zz[j]!='\0';j++) { if(p1->zz[j]==i)num[i]++; } p1=p1->next; } } max=0; for(i='A';i<='Z';i++) { max=max>num[i]?max:num[i];//????????? } for(i='A';i<='Z';i++) { if(num[i]==max)zzzd=i;//???????? } printf("%c\n%d\n",zzzd,max); p1=head; //zzdnum=0; for(i=0;i<n;i++) { for(j=0;p1->zz[j]!='\0';j++) { if(p1->zz[j]==zzzd)//????????? { printf("%d\n",p1->sl); } } p1=p1->next; } }
2
811
void main() { struct book { int num; char wri[26]; struct book *next; }; int n,m,i; scanf("%d",&m); struct book *head,*p1,*p2; n=0; p1=p2=(struct book *)malloc(L); scanf("%d%s",&p1->num,p1->wri); head=NULL; for(i=0;i<m-1;i++) { n=n+1; if(n==1)head=p1; else p2->next=p1; p2=p1; p1=(struct book *)malloc(L); scanf("%d%s",&p1->num,p1->wri); } p2->next=p1; p2=p1; p2->next=NULL; int a[26]={0},b,j,k,max1=0,max2; struct book *g; g=head; do { for(i=0;i<26;i++) { if(g->wri[i]!='\0') { b=g->wri[i]; a[b-65]=a[b-65]+1; } } g=g->next; }while(g!=NULL); for(i=0;i<26;i++) { if(max1<a[i]) { max1=a[i]; max2=i; } } max2=max2+65; printf("%c\n%d",max2,max1); g=head; do { for(i=0;i<26;i++) { if(g->wri[i]==max2) { printf("\n%d",g->num); break; } } g=g->next; }while(g!=NULL); }
2
812
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;} } }
2
813
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; }
2
814
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; }
2
815
struct a { int number; char author[26]; }b[100]; int main() { int L[26]={0}; int n=0; int max=0; int p=0; cin>>n; for(int i=0;i<n;i++) { cin>>b[i].number; cin>>b[i].author; for(int j=0;b[i].author[j]!='\0';j++) L[b[i].author[j]-'A']++; } for(int i=0;i<26;i++) if(max<L[i]) { p=i; max=L[i]; } cout<<(char)(p+'A')<<endl; cout<<max<<endl; for(int i=0;i<n;i++) { for(int j=0;b[i].author[j]!='\0';j++) { if(b[i].author[j]-p=='A') { cout<<b[i].number<<endl; break; } } } return 0; }
2
816
struct book { int a; char b[30]; struct book *next; }; void main() { int i,k,m,max=0,t; char j,ch; struct book *head,*p1,*p2; scanf("%d",&m); p1=(struct book*)calloc(1,sizeof(struct book)); head=p1; for(i=0;i<m;i++) { scanf("%d %s",&(p1->a),p1->b); p2=p1; if(i==m-1) p2->next=NULL; else { p1=(struct book*)calloc(1,sizeof(struct book)); p2->next=p1; } } for(j='A';j<='Z';j++) { t=0; p1=head; while(p1) { for(k=0;k<strlen(p1->b);k++) if((p1->b)[k]==j) t++; p1=p1->next; } if(t>max) { max=t; ch=j; } } printf("%c\n",ch); printf("%d\n",max); p1=head; while(p1) { for(k=0;k<strlen(p1->b);k++) if((p1->b)[k]==ch) printf("%d\n",p1->a); p1=p1->next; } }
2
817
struct shu { int num; char author_name[27]; }; int main() { int ere[26]; int m,i,max=0,key; for(i=0;i<26;i++) { ere[i]=0; } char *a; struct shu book[999]; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d",&book[i].num); scanf("%s",book[i].author_name); } for(i=0;i<m;i++) { a=book[i].author_name; while(*a!='\0') { ere[(*a)-'A']++; a++; } } for(i=0;i<26;i++) { if(ere[i]>=max) { max=ere[i]; key=i; } } printf("%c\n",(key+'A')); printf("%d\n",ere[key]); for(i=0;i<m;i++) { a=book[i].author_name; while(*a!='\0') { if((key+'A')==*a) { printf("%d\n",book[i].num); break; } a++; } } return 0; }
2
818
struct book { int id; char writer[30]; }book[1200]; int main() { int n,l,t,a[30]; char m; cin>>n; for(int i=0;i<30;i++) a[i]=0; for(int i=0;i<n;i++) { cin>>book[i].id>>book[i].writer; l=strlen(book[i].writer); for(int j=0;j<l;j++) { t=book[i].writer[j]-65; a[t]++; } } t=a[0];l=0; for(int i=0;i<26;i++) { if(a[i]>t) { l=i; t=a[i]; } } m=l+65; cout<<m<<endl; cout<<t<<endl; for(int i=0;i<30;i++) a[i]=0; for(int i=0;i<n;i++) { l=strlen(book[i].writer); for(int j=0;j<l;j++) { if(book[i].writer[j]==m) cout<<book[i].id<<endl; } } return 0; }
2
819
struct test { int num; int book[100]; }a[26]; int main() { int n,i,j,index,temp,max; char s[100]; char ch; scanf("%d",&n); for (i=0;i<26;i++) { a[i].num=0; } for (i=0;i<n;i++) { scanf("%d %s",&index,&s); for (j=0;s[j]!='\0';j++) { temp = (int)(s[j]-'A'); a[temp].book[a[temp].num]=index; a[temp].num++; } } max = 0; for (i=0;i<26;i++) { if (a[i].num>a[max].num) max = i; } ch = (char)('A'+max); printf("%c\n",ch); printf("%d\n",a[max].num); for (i=0;i<a[max].num;i++) { printf("%d\n",a[max].book[i]); } return 0; }
2
820
struct book { int num; char name[26]; struct book *next; }; struct book *creat(int m) { struct book *head,*p1,*p2; p1=(struct book *)malloc(sizeof(struct book)); scanf("%d %s",&p1->num,p1->name); int i; for(i=1;i<m;i++) { if(i==1) head=p1; else p2->next=p1; p2=p1; p1=(struct book *)malloc(sizeof(struct book)); scanf("%d %s",&p1->num,p1->name); } p2->next=p1;p1->next=NULL; return(head); } main() { struct book *head,*p; int i,j,m,k,l,max=0; scanf("%d",&m); head=creat(m); int *a; a=(int *)malloc(26*sizeof(int)); for(i=0;i<26;i++) *(a+i)=0; p=head; for(i=0;i<m;i++) { k=strlen(p->name); for(j=0;j<k;j++) for(l=0;l<26;l++) if(*(p->name+j)==l+65) (*(a+l))++; p=p->next; } for(i=0;i<26;i++) if(max<*(a+i)) max=*(a+i); for(i=0;i<26;i++) if(max==*(a+i)) {printf("%c\n%d\n",i+65,max);break;} p=head; for(j=0;j<m;j++) { k=strlen(p->name); for(l=0;l<k;l++) if(*(p->name+l)==i+65) printf("%d\n",p->num); p=p->next; } }
2
821
int main() { int n, count[30] = {0}, num[30][1000] = {0}; cin >> n; while (n--) { int no; char c; cin >> no; cin.get(); while ((c = cin.get()) != '\n') { num[c - 'A'][count[c - 'A']++] = no; } } int max =count[0], set = 0; for (int i = 1; i < 26; i++) { if (max < count[i]) { max = count[i]; set = i; } } cout << (char) (set + 'A') << endl << max << endl; for (int i = 0; i < max; i++) { cout << num[set][i] << endl; } return 0; }
2
822
void main() { int s=0,n,i,j,b[26]={0},t,x,m,q; char a[1000][27]; scanf("%d\n",&n); for(i=0;i<n;i++) { gets(a[i]); } for(i=0;i<n;i++) { t=strlen(a[i]); for(j=4;j<t;j++) { x=a[i][j]; b[x-65]=b[x-65]+1; } } for(i=0;i<26;i++) { if(b[i]>s) {s=b[i];x=i;} } printf("%c\n",x+65); printf("%d\n",s); for(i=0;i<n;i++) { t=strlen(a[i]); for(j=4;j<t;j++) { m=a[i][j]; if(m==x+65) { for(q=0;q<2;q++) {printf("%c",a[i][q]);} printf("%c\n",a[i][2]); } } } }
2
823
int main() { int m,i,j,k=0; struct {int n; char s[26]; }book[999]; scanf("%d",&m); for(i=0;i<m;i++) scanf("%d %s",&book[i].n,&book[i].s); int a[26]={0}; for(i=0;i<m;i++) for(j=0;book[i].s[j]!='\0';j++) a[(int)(book[i].s[j]-'A')]++; for(i=1;i<26;i++) if(a[k]<a[i]) k=i; printf("%c\n%d\n",k+'A',a[k]); for(i=0;i<m;i++) for(j=0;book[i].s[j]!='\0';j++) if(book[i].s[j]==k+'A') { printf("%d\n",book[i].n); break; } }
2
824
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); } } }
2
825
/*????????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; }
2
826
main() { int m,n,j,k,id[1001],a[26]={0}; char c[1001][26],b[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; scanf("%d",&n); for(j=1;j<=n;j++) {scanf("%d %s",&id[j],&c[j]);} for(m=0;m<26;m++) { for(j=1;j<=n;j++) { for(k=0;k<26;k++) {if(b[m]==c[j][k]) a[m]=a[m]+1;} } } int t=0,r=0; for(m=0;m<=25;m++) { if(t<a[m]) {t=a[m];r=m;} } printf("%c\n%d",b[r],a[r]); for(j=1;j<=n;j++) { for(k=0;k<26;k++) { if(c[j][k]==b[r]) printf("\n%d",id[j]); } } }
2
827
struct book { char number[20]; char name[26]; }books[1000]; main() { int n,i,j;int count[26]={0};int temp,base,k=0;char author;int pd=0,N=0; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s %s",&books[i].number,&books[i].name); } for(i=0;i<n;i++) { for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++) { temp=books[i].name[j]-'A'; count[temp]++; } } base=count[0]; for(i=0;i<26;i++) { if(count[i]>base) {base=count[i];k=i;} } author='A'+k; printf("%c\n",author); for(i=0;i<n;i++) { pd=0; for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++) { if(books[i].name[j]==author) pd=1; } if(pd==1) N++; } printf("%d\n",N); for(i=0;i<n;i++) { pd=0; for(j=0;books[i].name[j]>='A'&&books[i].name[j]<='Z';j++) { if(books[i].name[j]==author) pd=1; } if(pd==1) printf("%s\n",books[i].number); } }
2
828
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; }
2
829
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; }
2
830
struct book { int num; char author[26]; struct book *next; }; struct book *creat() { int n; scanf("%d",&n); int i=1; struct book *head,*p1,*p2; p1=(struct book*)malloc(LEN); scanf("%d %s",&p1->num,p1->author); p1->next=NULL; if(i>=n) {free(p1);head=NULL;return head;} else {head=p1; p2=p1; while(i<n) {p1=(struct book*)malloc(LEN); scanf("%d %s",&p1->num,p1->author); p1->next=NULL; i++; {p2->next=p1;p2=p1;} } p2->next=p1; p1->next=NULL; return head; } } int max(char letter,struct book *head) { int i,j,k; i=0; struct book *q; q=head; while(q!=NULL) { k=strlen(q->author); for(j=0;j<k;j++) {if((q->author)[j]==letter) i++;} q=q->next; } return i; } void outbook(char letter,struct book *head) { int j,k; struct book *q; q=head; while(q!=NULL) { k=strlen(q->author); for(j=0;j<k;j++) {if((q->author)[j]==letter) printf("%d\n",q->num);} q=q->next; } } void main() { int i,m,s; struct book *p0,*p1; p0=p1=creat(); int sum[26]; for(i=0;i<26;i++) { sum[i]=max(i+65,p0); } s=0; m=sum[0]; for(i=0;i<26;i++) { if(sum[i]>m) {m=sum[i];s=i;} } printf("%c\n",s+65); printf("%d\n",m); outbook(s+65,p1); }
2
831
struct Book { int number; char author[30]; }; void main() { int max=0,len; int sum[30]={0}; int m,i,j; struct Book book[999]; scanf("%d",&m); for(i=0;i<m;i++) { scanf("%d %s",&book[i].number,book[i].author); len=strlen(book[i].author); for(j=0;j<len;j++) sum[book[i].author[j]-65]++; } for(i=0;i<26;i++) { if(sum[i]>sum[max]) max=i; } printf("%c\n%d\n",max+65,sum[max]); for(i=0;i<m;i++) { len=strlen(book[i].author); for(j=0;j<len;j++) { if(book[i].author[j]==max+65) { printf("%d\n",book[i].number); break; } } } }
2
832
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); }
2
833
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; } }
2
834
struct su { int a; char b[26]; struct su *next; }; int main() { int n,c[26]={0},i,k,j,l,max,m; struct su *p,*head,*q; scanf("%d",&n); for(i=0;i<n;i++) { p=(struct su *)malloc(sizeof(struct su)); if(i==0) {head=p; q=p; scanf("%d %s",&p->a,p->b); k=strlen(p->b); for(j=0;j<k;j++) { l=p->b[j]-'A'; c[l]=c[l]+1; } } else { q->next=p; q=p; scanf("%d %s",&p->a,p->b); k=strlen(p->b); for(j=0;j<k;j++) { l=p->b[j]-'A'; c[l]=c[l]+1; } } } q->next=NULL; max=c[0]; m=0; for(j=0;j<26;j++) { if(max<c[j]) {max=c[j]; m=j; } } printf("%c\n%d\n",m+'A',max); p=head; do { k=strlen(p->b); for(j=0;j<k;j++) { if(('A'+m)==p->b[j]) { printf("%d\n",p->a); } } p=p->next; }while(p!=NULL); return 0; }
2
835
struct chs{ char zz[27]; int num; }cs[],*p; int main(){ int n; scanf("%d",&n); struct chs *cs=(struct chs *)malloc(sizeof(struct chs)*n); for(p=cs;p<cs+n;p++){ scanf("%d%s",&(p->num),p->zz); } int l,a,zm[26],*z; for(z=zm;z<zm+26;z++){ *z=0; } char *q; for(p=cs;p<cs+n;p++){ l=strlen(p->zz); for(q=p->zz;*q!='\0';q++){ a=(int)(*q); (*(zm+a-65))++; } } int max=0; for(z=zm;z<zm+26;z++){ if(*z>*(zm+max)){ max=z-zm; } } printf("%c\n%d\n",(char)(max+65),*(zm+max)); for(p=cs;p<cs+n;p++){ l=strlen(p->zz); for(q=p->zz;*q!='\0';q++){ a=(int)(*q); if((a-65)==max){ printf("%d\n",p->num); } } } free(cs); return 0; }
2
836
int main() { int record[26][1000]; memset(record,0,sizeof(record)); char name[10]; int m,temp; cin>>m; for (int i=0;i<m;i++) { cin>>temp; cin.get(); cin.getline(name,10); for (int i=0;i<strlen(name);i++) { record[name[i]-65][record[name[i]-65][0]+1]=temp; record[name[i]-65][0]++; } } int flag=0; for (int i=0;i<25;i++) { if (record[i][0]>record[flag][0]) { flag=i; } } cout<<(char)(flag+65)<<endl<<record[flag][0]<<endl; for (int i=1;i<=record[flag][0];i++) { cout<<record[flag][i]<<endl; } return 0; }
2
837
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; }
2
838
int main() { int a[26][999],t,i,n[26],k,j,b=0; char x[27]; scanf("%d",&t); for(i=0;i<26;i++) { n[i]=0; } for(i=0;i<t;i++) { scanf("%d%s",&k,x); for(j=0;x[j]!='\0';j++) { a[x[j]-65][n[x[j]-65]]=k; n[x[j]-65]++; } } for(i=0;i<26;i++) { if(n[i]>b) { b=n[i]; j=i; } } printf("%c\n",j+65); printf("%d\n",n[j]); for(i=0;i<n[j];i++) { printf("%d\n",a[j][i]); } return 0; }
2
839
struct BOOK { int No; char author[27]; }book[999]; int letter[26]={0}; main() { int letter[26]={0}; int count=0; int m,n,s; scanf("%d",&m); int i,j,max; for(i=0;i<m;i++){ scanf("%d%s",&book[i].No,&book[i].author); } for(i=0;i<m;i++){ for(j=0;j<strlen(book[i].author);j++){ n=book[i].author[j]-65; letter[n]++; } } max=letter[0]; for(n=0;n<26;n++){ if(letter[n]>max){ max=letter[n]; } } for(n=0;n<26;n++){ if(max==letter[n]){ s=n; printf("%c\n%d\n",n+65,max); break; } } for(i=0;i<m;i++){ for(j=0;j<strlen(book[i].author);j++){ if(s==book[i].author[j]-65){ printf("%d\n",book[i].No); } } } }
2
840
int main(int argc, char* argv[]) { int m,i,j,len,max; int id[1000],b[26]={0}; char a[100][27],name; scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d %s",&id[i],a[i]); len=strlen(a[i]); for(j=0;j<len;j++){ b[a[i][j]-'A']++; } }//?????????????????????????? max=b[0];name='A'; for(j=1;j<26;j++){ if(b[j]>max){ max=b[j]; name=j+'A'; } } printf("%c\n%d\n",name,max);//???????????????? for(i=0;i<m;i++){ len=strlen(a[i]); for(j=0;j<len;j++){ if(a[i][j]==name) {strcpy(a[i],"shuchu"); break;}//???????????? } } for(i=0;i<m;i++){ if(strcmp(a[i],"shuchu")==0) printf("%d\n",id[i]);//??????????? } return 0; }
2
841
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; }
2
842
int c[255]; int main() { int i,j,n; char m = 0; struct { int id; char s[255]; } a[1000]; scanf("%d", &n); for (i=0;i<n;i++) { scanf("%d%s", &a[i].id, a[i].s); for (j=0; a[i].s[j]; j++) { if (++c[a[i].s[j]] > c[m]) m=a[i].s[j]; } } printf("%c\n%d\n", m, c[m]); for (i=0;i<n;i++) { if (strchr(a[i].s, m)) printf("%d\n", a[i].id); } return 0; }
2
843
int main() { int m,sum[27]={0},max=0,author; cin>>m; char str[1000][4],name[1000][27]; for(int i=0;i<m;i++) cin>>str[i]>>name[i]; for(int i=0;i<m;i++){ for(int j=0;j<strlen(name[i]);j++) sum[name[i][j]-'A']++; } for(int i=0;i<26;i++){ if(max<sum[i]){ max=sum[i]; author=i; } } cout<<(char)('A'+author)<<endl; cout<<max<<endl; for(int i=0;i<m;i++){ for(int j=0;j<strlen(name[i]);j++){ if(name[i][j]-'A'==author) cout<<str[i]<<endl; } } return 0; }
2
844
int main() { struct book { int num; char author[26]; }list[999],*p; int n; int count[26]={0}; int i; char k='A'; int max; scanf("%d",&n); for(p=list;p<list+n;p++){ scanf("%d %s",&p->num,p->author); } for(p=list;p<list+n;p++){ for(i=0;;i++){ if(p->author[i]=='\0'){ break; }else{ count[p->author[i]-65]++; } } } max=count[0]; for(i=1;i<26;i++){ if(count[i]>max){ max=count[i]; k=i+65; } } printf("%c\n",k); printf("%d\n",max); for(p=list;p<list+n;p++){ for(i=0;;i++){ if(k==p->author[i]){ printf("%d\n",p->num); } if(p->author[i]=='\0'){ break; } } } return 0; }
2
845
struct book {int num; char str[200]; }bk[1000]; int main() { int m,i,l,k,p=0,max,maxl; int a[200][1000]; int b[200]; scanf("%d",&m); for(i=0;i<m;i++) scanf("%d%s",&bk[i].num,bk[i].str); for(l=0;l<26;l++) { for(i=0;i<m;i++) { for(k=0;bk[i].str[k]!='\0';k++) { if((bk[i].str[k])==l+65) {a[l][p]=bk[i].num; p++;} } } b[l]=p; p=0; } max=b[0];maxl=0; for(l=0;l<26;l++) { if(b[l]>max) {max=b[l]; maxl=l;} } printf("%c\n",maxl+65); printf("%d\n",max); for(i=0;i<max;i++) printf("%d\n",a[maxl][i]); return 0; }
2
846
struct xinxi { int sh; char zz[20]; }a[1000]; void main() { int n,i,l,j,b[26]={0},m=0,k=0; char c; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d%s",&a[i].sh,a[i].zz); for(i=0;i<n;i++) { l=strlen(a[i].zz); for(j=0;j<l;j++) b[a[i].zz[j]-65]++; } for(i=0;i<26;i++) if(b[i]>m) {m=b[i];k=i;} c=k+65; printf("%c\n%d\n",c,m); for(i=0;i<n;i++) { l=strlen(a[i].zz); for(j=0;j<l;j++) if(a[i].zz[j]==c) printf("%d\n",a[i].sh); } }
2
847
main() { int n; scanf("%d",&n); struct { int num; char a[25]; }book [999]; int i,j; for(i=0;i<=n-1;i++) { scanf("%d %s",&book[i].num,book[i].a); } int s[26]={0}; for(i=0;i<=n-1;i++) { int len=strlen(book[i].a); for(j=0;j<len;j++) { s[book[i].a[j]-'A']++; } } int max=0; char name; for(i=0;i<=25;i++) { if(s[i]>max) { max=s[i]; name='A'+i; } } printf("%c\n",name); printf("%d\n",max); for(i=0;i<=n-1;i++) { int len=strlen(book[i].a); for(j=0;j<len;j++) { if(book[i].a[j]==name) printf("%d\n",book[i].num); } } }
2
848
int main(){ int max,max1,t,k,x[28]={0},n,a,b,c,d,i,j; char cc,y[100][32],q; scanf("%d",&n); scanf("%c",&cc); for(i=1;i<=n;i++){ gets(y[i]); for(j=2;y[i][j];j++){ if(y[i][j]>='A'&&y[i][j]<='Z'){ x[y[i][j]+1-'A']++;} }} max=x[1]; max1=1; for(i=2;i<=26;i++){ if(x[i]>max){ max=x[i]; max1=i;}} q='A'-1+max1; printf("%c\n",q); printf("%d\n",max); for(i=1;i<=n;i++){ for(j=2;y[i][j];j++){ if(y[i][j]==q){ for(t=0;y[i][t];t++){ if(y[i][t]==' ')break; else printf("%c",y[i][t]); } printf("\n"); break; } } } }
2
849
int main() { int m; int i, j, a,n; struct book{ int no; char name[30]; }book[999]; int author1[30]={0}, author2[30]={0}; char k; scanf("%d", &m); for(i=0;i<m;i++) scanf("%d %s", &book[i].no, &book[i].name); for(i=0;i<m;i++){ a = strlen(book[i].name); for(j=0;j<a;j++){ for(k='A';k<='Z';k++){ if(book[i].name[j]==k) author1[(int)k-65]++; } } } for(i=0;i<26;i++) author2[i]=author1[i]; for(i=0;i<26;i++){ for(j=i+1;j<26;j++){ if(author1[i]<author1[j]){ int tmp; tmp = author1[i]; author1[i] = author1[j]; author1[j]= tmp; } } } for(i=0;i<26;i++){ if(author2[i] == author1[0]){ printf("%c\n", (char)(65+i)); printf("%d\n", author1[0]); for(j=0;j<m;j++){ a = strlen(book[j].name); for(n=0;n<a;n++){ if(book[j].name[n]==(char)(65+i)){ printf("%d\n", book[j].no); break; } } } } } return 0; }
2
850
struct Bo{ int num; char auth[30]; }a[1010]; void main(){ int n,i,j,maxnum=0,max; int zuozhe[26]={0}; char out; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%d %s",&a[i].num,a[i].auth); for(j=0;j<=strlen(a[i].auth)-1;j++) zuozhe[a[i].auth[j]-'A']=zuozhe[a[i].auth[j]-'A']+1; } for(i=1;i<=25;i++) if(zuozhe[i]>zuozhe[maxnum]) maxnum=i; out='A'+maxnum; printf("%c\n",out); printf("%d\n",zuozhe[maxnum]); for(i=1;i<=n;i++) { if(strchr(a[i].auth,out)!=NULL) printf("%d\n",a[i].num); } }
2
851
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]); }
2
852
int n; struct student { int num; char name[100]; struct student *next; }; struct student *creat(void) { struct student *head; struct student *p1,*p2; int i; p1=(struct student*)malloc(LEN); scanf("%d",&p1->num); scanf("%s",p1->name); p1->next=NULL; head=p1; p2=p1; for(i=1;i<n;i++) { p1=(struct student*)malloc(LEN); scanf("%d",&p1->num); scanf("%s",p1->name); p1->next=NULL; p2->next=p1; p2=p1; } return (head); } void main() { struct student *head; struct student *p1; char *p2; int i; int a[26]; for(i=0;i<26;i++) { a[i]=0; } scanf("%d",&n); head=creat(); p1=head; do { p2=p1->name; for(;(*p2)!='\0';p2++) { if((*p2)=='A') { a[0]=a[0]+1; } if((*p2)=='B') { a[1]=a[1]+1; } if((*p2)=='C') { a[2]=a[2]+1; }if((*p2)=='D') { a[3]=a[3]+1; }if((*p2)=='E') { a[4]=a[4]+1; }if((*p2)=='F') { a[5]=a[5]+1; }if((*p2)=='G') { a[6]=a[6]+1; }if((*p2)=='H') { a[7]=a[7]+1; }if((*p2)=='I') { a[8]=a[8]+1; }if((*p2)=='J') { a[9]=a[9]+1; }if((*p2)=='K') { a[10]=a[10]+1; }if((*p2)=='L') { a[11]=a[11]+1; }if((*p2)=='M') { a[12]=a[12]+1; }if((*p2)=='N') { a[13]=a[13]+1; }if((*p2)=='O') { a[14]=a[14]+1; }if((*p2)=='P') { a[15]=a[15]+1; }if((*p2)=='Q') { a[16]=a[16]+1; }if((*p2)=='R') { a[17]=a[17]+1; }if((*p2)=='S') { a[18]=a[18]+1; }if((*p2)=='T') { a[19]=a[19]+1; }if((*p2)=='U') { a[20]=a[20]+1; }if((*p2)=='V') { a[21]=a[21]+1; }if((*p2)=='W') { a[22]=a[22]+1; }if((*p2)=='X') { a[23]=a[23]+1; }if((*p2)=='Y') { a[24]=a[24]+1; }if((*p2)=='Z') { a[25]=a[25]+1; } } p1=p1->next; }while(p1!=NULL); int j,max=0; for(i=0;i<26;i++) { if(a[i]>max) { max=a[i]; j=i; } } printf("%c\n",j+65); printf("%d\n",a[j]); p1=head; do { p2=p1->name; for(;(*p2)!='\0';p2++) { if((*p2)==j+65) { printf("%d\n",p1->num); } } p1=p1->next; }while(p1!=NULL); }
2
853
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;}
2
854
struct jisuan{ int num; char name[26]; }book[1000]; int main() { int i,j,m,n,k,e; int count[26]={0},author[26]; scanf("%d",&m); for(i=0;i<26;i++) author[i]=65+i; for(i=0;i<m;i++){ scanf("%d",&book[i].num); gets(book[i].name); } for(i='A';i<='Z';i++){ for(j=0;j<m;j++){ n=strlen(book[j].name); for(k=0;k<n;k++){ if(i==book[j].name[k]) count[i-65]++; } } } for(i=0;i<25;i++){ if(count[i]>count[i+1]){ e=count[i]; count[i]=count[i+1]; count[i+1]=e; e=author[i]; author[i]=author[i+1]; author[i+1]=e; } } printf("%c\n%d\n",author[25],count[25]); for(i=0;i<m;i++){ n=strlen(book[i].name); for(k=0;k<n;k++){ if(book[i].name[k]==author[25]) printf("%d\n",book[i].num); } } return 0; }
2
855
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); }
2
856
int main() { int a[100][100],b[27],max= 0; int i , j , n , k , t ,len = 0; char str[100][27]; scanf("%d",&n); memset( a, 0 ,sizeof(a) ); memset( b ,0 ,sizeof(b) ); for( i = 1;i <= n;i++ ) { scanf( "%d",&a[i][1]); scanf("%s",str[i]); len = strlen (str[i]); for( j = 0;j < len;j++ ) { k = str[i][j]-'A'; b[k]++; a[i][k+65] = 1; } } for( i = 0;i <= 25 ;i++ ) { if( b[i] >max ) { max= b[i]; t = i; } } printf("%c\n%d\n",t+'A',max); for( i = 1;i <= n;i++ ) { if( a[i][t+'A']==1 ) printf("%d\n",a[i][1]); } }
2
857
int main() { int m,i,j,k,q=0,t=0,u,max; int b[26]={0}; char c[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; struct as{ int sh; char a[26]; }cla[1000]; scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d %s",&cla[i].sh,cla[i].a); t=(int)strlen(cla[i].a); for(k=0;k<t;k++){ u=cla[i].a[k]-'A'; b[u]++; } } max=0; for(j=0;j<25;j++) if(max<b[j]){ max=b[j]; q=j; } printf("%c\n",c[q]); printf("%d\n",max); for(i=0;i<m;i++){ t=(int)strlen(cla[i].a); for(k=0;k<t;k++) if(cla[i].a[k]==c[q]) printf("%d\n",cla[i].sh); } return 0; }
2
858
struct book { int num; char name[20]; }; void main() { struct book c[1000]; int i,j,n,k,max,l,d[26],a; int b[26]={0}; scanf("%d",&n); for(k=0;k<n;k++) { scanf("%d %s",&c[k].num,c[k].name); for(i=0;i<strlen(c[k].name);i++) { for(j=0;j<26;j++) { if('A'+j==c[k].name[i]) break; } b[j]=b[j]+1; } } for(a=0;a<26;a++) d[a]=b[a]; max=b[0]; for(l=0;l<26;l++) if(b[l]>max) max=b[l]; for(a=0;a<26;a++) { if(d[a]==max) break; } printf("%c\n",'A'+a); printf("%d\n",max); for(k=0;k<n;k++) { for(i=0;i<strlen(c[k].name);i++) { if('A'+a==c[k].name[i]) { printf("%d\n",c[k].num); break; } } } }
2
859
struct book { int number; char a[26]; int la; struct book *next; }; struct book *insert(struct book *head,struct book *temp) { struct book *p0,*p1,*p2; p1=head; p0=temp; if(head==NULL) {head=p0;p0->next=NULL;} else { while(p1->next!=NULL) {p1=p1->next;} p1->next=p0; p0->next=NULL; } return head; } void main() { struct book *p,*temp,*head=NULL; int i,m,max; int b[26]={0}; char writer; scanf("%d",&m); for(i=0;i<m;i++) { temp=(struct book *)malloc(sizeof(struct book)); scanf("%d ",&temp->number); gets(temp->a); temp->la=strlen(temp->a); temp->next=NULL; head=insert(head,temp); } p=head; while(p!=NULL) { for(i=0;i<p->la;i++) b[p->a[i]-65]++; p=p->next; } max=b[0];writer=65; for(i=0;i<26;i++) { if(b[i]>max) { max=b[i]; writer=i+65; } } printf("%c\n%d\n",writer,max); p=head; while(p!=NULL) { for(i=0;i<p->la;i++) if(p->a[i]==writer) {printf("%d\n",p->number);break;} p=p->next; } }
2
860
int main() { int *p; char q[1000][30]; int shu[26]={0}; char zm[]={'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 n,i,j,k; int len,max=0; scanf("%d",&n); p=(int*)malloc(sizeof(int)*n); for(i=0;i<n;i++) { len=0; scanf("%d %s", &p[i],q[i]); len=strlen(q[i]); for(j=0;j<len;j++) { for(k=0;k<26;k++) { if(q[i][j]==zm[k]) shu[k]++; } } } for(i=0;i<26;i++) { if(shu[i]>max) { max=shu[i]; k=i; } } printf("%c\n%d\n",zm[k],shu[k]); for(i=0;i<n;i++) { len=strlen(q[i]); for(j=0;j<len;j++) { if(q[i][j]==zm[k]) printf("%d\n",p[i]); } } free(p); return 0; }
2
861
struct { int num; char name[27]; }book[999]; struct { int cishu; }ren[26]; int main() { int n,zimu,a,b,i,j; int sz[26]; char m; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %s",&book[i].num,book[i].name); } for(i=0;i<n;i++) { for(j=0;book[i].name[j]!='\0';j++) { zimu=book[i].name[j]-65; ren[zimu].cishu++; } } a=0; b=ren[0].cishu; for(i=1;i<26;i++) { if(ren[i].cishu>b) { a=i; b=ren[i].cishu; } } m=a+65; printf("%c\n",m); printf("%d\n",b); for(i=0;i<n;i++) { for(j=0;j<26;j++) { if(book[i].name[j]==m) { printf("%d\n",book[i].num); } } } return 0; }
2
862
struct book { int num; char str[26]; }bk[1000]; void main() { int m,i,j,k,s,n=0; char a[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','R','S','T','U','V','W','X','Y','Z'}; int b[26]={0}; scanf("%d",&m); for(i=0;i<m;i++) scanf("%d %s",&bk[i].num,bk[i].str); for(i=0;i<m;i++) for(j=0;j<strlen(bk[i].str);j++) for(k=0;k<26;k++) if(a[k]==bk[i].str[j]) b[k]++; for(i=0;i<26;i++) if(b[i]>n) { n=b[i]; s=i; } printf("%c\n%d\n",a[s],b[s]); for(i=0;i<m;i++) for(j=0;j<strlen(bk[i].str);j++) if(bk[i].str[j]==a[s]) printf("%d\n",bk[i].num); }
2
863
struct info { int num; char author[30]; struct info *next; }; struct info*create(int n) { struct info *p1,*p2,*head; int i; p1=(struct info*)malloc(sizeof(struct info)); scanf("%d%s",&p1->num,p1->author); p1->next=NULL; p2=p1; head=p1; i=1; while(i<n) { p1=(struct info*)malloc(sizeof(struct info)); scanf("%d%s",&p1->num,p1->author); p1->next=NULL; p2->next=p1; p2=p1; i++; } return head; } int main() { int n,i,t,index,j; struct info *head,*p; int *g; scanf("%d",&n); head=create(n); g=(int*)malloc(26*sizeof(int)); p=head; for(i=0,t=0;i<26;i++) { *(g+i)=0; } for(i=0;i<n;i++) { j=0; while(*(p->author+j)!='\0') {(*(g+(*(p->author+j))-65))++;j++;} p=p->next; } for(i=0,t=0;i<26;i++) { if(*(g+i)>t) {t=*(g+i);index=i;} } printf("%c\n",index+65); printf("%d\n",*(g+index)); p=head; for(i=0;i<n;i++) { j=0; while(*(p->author+j)!='\0') {if(*(p->author+j)==index+65) {printf("%d\n",p->num);} j++; } p=p->next; } }
2
864
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; }
2
865
int main() { int n,a[999],i,k[27]={0},j,t,m; char b[999][27]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %s",&a[i],b[i]); for(j=0;b[i][j];j++) k[b[i][j]-65]++; } t=k[0];m=0; for(j=0;j<26;j++) { if(k[j]>t) {t=k[j];m=j;} } printf("%c\n%d\n",m+65,t); for(i=0;i<n;i++) { for(j=0;b[i][j];j++) { if(b[i][j]==m+65) { printf("%d\n",a[i]); break; } } } return 0; }
2
866
int main() {struct book{ int num; char s[26]; }b[1000]; struct author{ int n[1000]; int p; char c; }a[26],e; int i,j,k,m,q,max; char d; for(i=0;i<26;i++) a[i].p=0; for(i=0,d='A';i<26;i++,d++) {a[i].c=d;} scanf("%d",&m); for(i=0;i<m;i++) {scanf("%d%s",&b[i].num,b[i].s);} for(i=0;i<m;i++) {for(j=0;;j++) {if(b[i].s[j]=='\0') break; for(k=0;k<26;k++) {if(b[i].s[j]==a[k].c) {a[k].n[a[k].p]=b[i].num; a[k].p+=1;}}}} max=a[0].p; e=a[0]; for(i=0;i<26;i++) {if(a[i].p>max) {e=a[i];max=a[i].p;}} printf("%c\n",e.c); printf("%d\n",e.p); for(j=0;j<e.p;j++) printf("%d\n",e.n[j]);}
2
867
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; } }
2
868
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); }
2
869
struct book { char writer[32]; int id; struct book *next; }; struct book *create(int m) { struct book *head=NULL,*p1,*p2; int i; p1=p2=(struct book*)malloc(Len); scanf("%d %s",&p1->id,p1->writer); p1->next=NULL; head=p1; p2=p1; for(i=1;i<m;i++) { p1=(struct book*)malloc(Len); scanf("%d %s",&p1->id,p1->writer); p1->next=NULL; p2->next=p1; p2=p1; } return head; } int main() { struct book *head,*p; int m,i,*q1,*q2,j; q1=(int*)malloc(26*sizeof(int*)); q2=q1; for(i=0;i<26;i++) q1[i]=0; q1=q2; scanf("%d",&m); head=create(m); p=head; for(i=0;i<m;i++) { for(j=0;p->writer[j]!='\0';j++) q1[p->writer[j]-'A']++; p=p->next; } q1=q2; int max=0; char maxm='A'; for(i=0;i<26;i++) if(max<q1[i]) {max=q1[i];maxm=i+'A';} printf("%c\n%d",maxm,max); for(i=0,p=head;i<m;i++,p=p->next) for( j=0;p->writer[j]!='\0';j++) if(p->writer[j]==maxm) printf("\n%d",p->id); }
2
870
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]); }
2
871
int main() { int m; cin>>m; int book[1000]; char person[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char people[100][100]; int i,j; int l; int t[100]={0}; for(i=1;i<=m;i++) { cin>>book[i]; cin>>people[i]; l=strlen(people[i]); for(j=0;j<l;j++) { t[people[i][j]-'A']++; } } int max=0,tt; for(i=0;i<=26;i++) { if(t[i]>max) { max=t[i]; tt=i; } } cout<<person[tt]<<endl; cout<<max<<endl; int k; int already[26]={1}; for(i=1;i<=m;i++) { l=strlen(people[i]); for(j=0;j<l;j++) { if(people[i][j]==person[tt]) { cout<<book[i]<<endl; for(k=0;k<l;k++) { if((people[i][k]!=person[tt])&&(already[people[i][k]-'A']!=0)) { //cout<<people[i][k]<<endl; already[people[i][k]-'A']=0; } } break; } } } return 0; }
2
872
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++; } }
2
873
struct Au{ int num; int a[1000]; } au[26]; int main () { int i, n, buch, tn; char s[30]; for(i=0; i<26; i++) au[i].num=0; scanf("%d", &n); while(n--) { scanf("%d%s", &buch, s); for (i=0; s[i]; i++) { tn=au[s[i]-'A'].num; au[s[i]-'A'].a[tn]=buch; au[s[i]-'A'].num++; } } int temp=0; for (i=1; i<26; i++) if (au[i].num>au[temp].num) temp=i; printf("%c\n%d\n", 'A'+temp, au[temp].num); for (i=0; i<au[temp].num; i++) printf("%d\n", au[temp].a[i]); return 0; }
2
874
struct zuozhe { int m; char q; char shu[1001][5]; }zuozhe[26],t; int main() { int n; cin>>n; int i; char xingming[30]; char bianhao[5]; char zimu[27]="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for(i=0;i<26;i++) zuozhe[i].m=0; for(i=1;i<=n;i++) { cin>>bianhao>>xingming; int j,k; for(j=0;xingming[j]!='\0';j++) { for(k=0;k<26;k++) { if(xingming[j]==zimu[k]) { zuozhe[k].m++; zuozhe[k].q=zimu[k]; strcpy(zuozhe[k].shu[zuozhe[k].m],bianhao); break; } } } } int min=0; int maxnum = 0; for(i=0;i<26;i++) { if(zuozhe[i].m>maxnum) { maxnum = zuozhe[i].m; min = i; } } cout<<zuozhe[min].q<<endl<<zuozhe[min].m<<endl; for(i=1;i<=zuozhe[min].m;i++) { cout<<zuozhe[min].shu[i]<<endl; } return 0; }
2
875
struct student{ char name[27]; int anum; int num; struct student *next; }; int n; int i; char c; struct student *creat() { struct student *head; head=(struct student *)malloc(LEN); if(n==0) head=NULL; else { scanf("%d",&head->num); for(i=0;(c=getchar())!='\n';i++) { head->name[i]=c; } head->anum=i; head->next=NULL; } return(head); } int main() { struct student *head,*p1,*p2,*p; char l[200]={0}; int j; int max=0; int lmax; scanf("%d",&n); head=creat(); p1=p2=head; for(i=1;i<n;i++) { { p1=(struct student *)malloc(LEN); p2->next=p1; p2=p1; scanf("%d",&p2->num); for(j=0;(c=getchar())!='\n';j++) { p2->name[j]=c; } p2->anum=j; p2->next=NULL; } } p=head; for(j=0;j<n;j++) { for(i=0;i<p->anum;i++) { l[p->name[i]]=l[p->name[i]]+1; } p=p->next; } for(i=65;i<=90;i++) { if(l[i]>max) { max=l[i]; lmax=i; } } printf("%c\n%d\n",lmax,max); p=head; for(j=0;j<n;j++) { for(i=0;i<p->anum;i++) { if(p->name[i]==lmax) printf("%d\n",p->num); } p=p->next; } return 0; }
2
876
int main(int argc, char* argv[]) { int N; int a[26]={0}; struct book{ int x; char y[27]; }A[1000]; scanf("%d",&N); int i,j; for(i=0;i<N;i++) { scanf("%d%s",&A[i].x,A[i].y); for(j=0;A[i].y[j]!='\0';j++) { if(A[i].y[j]=='A') { a[0]++; } else if(A[i].y[j]=='B') { a[1]++; } else if(A[i].y[j]=='C') { a[2]++; } else if(A[i].y[j]=='D') { a[3]++; } else if(A[i].y[j]=='E') { a[4]++; } else if(A[i].y[j]=='F') { a[5]++; } else if(A[i].y[j]=='G') { a[6]++; } else if(A[i].y[j]=='H') { a[7]++; } else if(A[i].y[j]=='I') { a[8]++; }else if(A[i].y[j]=='J') { a[9]++; } else if(A[i].y[j]=='K') { a[10]++; } else if(A[i].y[j]=='L') { a[11]++; } else if(A[i].y[j]=='M') { a[12]++; } else if(A[i].y[j]=='N') { a[13]++; } else if(A[i].y[j]=='O') { a[14]++; } else if(A[i].y[j]=='P') { a[15]++; } else if(A[i].y[j]=='Q') { a[16]++; } else if(A[i].y[j]=='R') { a[17]++; } else if(A[i].y[j]=='S') { a[18]++; } else if(A[i].y[j]=='T') { a[19]++; } else if(A[i].y[j]=='U') { a[20]++; } else if(A[i].y[j]=='V') { a[21]++; } else if(A[i].y[j]=='W') { a[22]++; } else if(A[i].y[j]=='X') { a[23]++; } else if(A[i].y[j]=='Y') { a[24]++; } else if(A[i].y[j]=='Z') { a[25]++; } } } int p; int max; p=0; max=a[0]; for (i=0;i<26;i++) { if (a[i]>max) { p=i; max=a[i]; } } char d; d=('A'+p); printf ("%c\n%d\n",d,max); for (i=0;i<N;i++) { for (j=0;A[i].y[j]!='\0';j++) { if (A[i].y[j]==(p+'A')) printf("%d\n",A[i].x); } } return 0; }
2
877
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; }
2
878
int ismax(int l[],int a) { int i; for(i=0;i<26;i++) { if(l[i]>l[a]) return(0); } return(1); } void main() { int i,j,k,n,p,l[26]={0}; struct shu { int num; char auth[100]; } book[999]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d %s",&book[i].num,book[i].auth); } for(i=0;i<26;i++) { for(j=0;j<n;j++) { for(k=0;k<100;k++) { if(book[j].auth[k]==i+65) l[i]++; } } } for(i=0;i<26;i++) { if(ismax(l,i)==1) { printf("%c\n%d\n",i+65,l[i]); p=i; } } for(i=0;i<n;i++) { for(j=0;j<100;j++) { if(book[i].auth[j]==p+65) printf("%d\n",book[i].num); } } }
2
879
char name; int num,k=0,t=0; int nametimes[100]={0}; struct book { unsigned int No; char Name[26]; }*p; void operate() { int i; for(i=65;i<91;i++) if(nametimes[i]>t) { t=nametimes[i]; name=i; } } void print() { struct book *pi; int i; printf("%c\n%d\n",name,t); for(pi=p;pi<p+num;pi++) for(i=0;pi->Name[i]!='\0';i++) if(pi->Name[i]==name) { if(k==0) { printf("%d",pi->No); k++; } else printf("\n%d",pi->No); break; } } main() { scanf("%d",&num); struct book *pi; int i; p=(struct book*)malloc(num*sizeof(struct book)); for(pi=p;pi<p+num;pi++) { scanf("%d %s",&pi->No,pi->Name); for(i=0;pi->Name[i]!='\0';i++) nametimes[(int)pi->Name[i]]++; } operate(); print(); }
2
880
struct book { int num; char writer[30]; struct book *next; }; int n; struct book *creat(void) { struct book *head; struct book *p1,*p2; int m=0; p1=p2=(struct book*)malloc(len); scanf("%d %s",&p1->num,p1->writer); head=NULL; while(m<n-1) { m++; if(m==1) head=p1; else p2->next=p1; p2=p1; p1=(struct book*)malloc(len); scanf("%d %s",&p1->num,p1->writer); } p2->next=p1; p2=p1; p2->next=NULL; return (head); } void main() { scanf("%d",&n); struct book * head,*p1; head=creat(); struct book *p; p=head; int i; int sum[27]; memset(sum,0,sizeof(sum)); char m; for(p=head;p!=NULL;p=p->next) {int x; for(i=0;i<strlen(p->writer);i++) { x=p->writer[i]-'A'; sum[x]++; } } int max=sum[0]; for(i=0;i<27;i++) { if(max<sum[i]) max=sum[i]; } for(i=0;i<27;i++) { if(sum[i]==max) {printf("%c\n%d\n",'A'+i,sum[i]);m='A'+i;} } for(p=head;p!=NULL;p=p->next) { for(i=0;i<strlen(p->writer);i++) { if(p->writer[i]==m) {printf("%d\n",p->num);break;} } } }
2
881
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; }
2
882
int main() { int n,a[1000],c[26]={0},max1=0,temp; char m[1000][26],max2; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i-1]; getchar(); cin.getline(m[i-1],26); } for(int i=0;i<n;i++) for(int j=0;j<26;j++) { c[m[i][j]-'A']++; } //cout<<c[1]<<endl; for(int s=0;s<26;s++) { //cout<<c[s]<<" "<<max1<<endl; if(max1<=c[s]) { max1=c[s]; temp=s+'A'; max2=temp; } } cout<<max2<<endl; cout<<max1<<endl; for(int i=0;i<n;i++) for(int j=0;j<26;j++) if(m[i][j]==max2) { cout<<a[i]<<endl; break; } return 0; }
2
883
int main() { int n; scanf("%d",&n); struct writer{ int sum; char c; }lit[26]={0,'A',0,'B',0,'C',0,'D',0,'E',0,'F',0,'G',0,'H',0,'I',0,'J',0,'K',0,'L',0,'M',0,'N',0,'O',0,'P',0,'Q',0,'R',0,'S',0,'T',0,'U',0,'V',0,'W',0,'X',0,'Y',0,'Z'}; struct book{ int id; char name[26]; }data[1000]; int i,j,k; for(i=0;i<n;i++) { scanf("%d%s",&data[i].id,&data[i].name); for(j=0;data[i].name[j]!='\0';j++) { for(k=0;k<26;k++) { if(data[i].name[j]==lit[k].c) lit[k].sum++; } } } for(i=1;i<26;i++) { if(lit[i].sum<lit[i-1].sum) { struct writer tmp; tmp=lit[i-1]; lit[i-1]=lit[i]; lit[i]=tmp; } } printf("%c\n%d\n",lit[25].c,lit[25].sum); for(i=0;i<n;i++) { for(j=0;data[i].name[j]!='\0';j++) { if(data[i].name[j]==lit[25].c) printf("%d\n",data[i].id); } } return 0; }
2
884
int main () { int m, i, j, k, n, max, l, y = 0; struct book { int num; char aut[26]; }book[1000]; int a[26] = {0}; char b[26] = {'A','B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'z'}; scanf ("%d", &m); for (i = 0; i < m; i++) { scanf ("%d %s", &book[i].num, book[i].aut); } for (i = 0; i < 26; i++) { for (j = 0; j < m; j++) { l = strlen(book[j].aut); for (k = 0; k < l; k++) { if (book[j].aut[k] == b[i]) { a[i]++; } } } } for (i = m; i > 0; i--) { for (j = 0; j < 26; j++) { if (a[j] == i) { max = a[j]; n = j; printf("%c\n", b[j]); printf ("%d\n", a[j]); y = 1; break; } } if (y == 1) { break; } } for (i = 0; i < m; i++) { l = strlen(book[i].aut); for (j = 0; j < l; j++) { if (book[i].aut[j] == b[n]) { printf("%d\n", book[i].num); } } } return 0; }
2
885
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; } } } } } }
2
886
struct author { char name; int count; }aut[26]; int max(struct author a[26]) { int i,max; max=a[0].count; for(i=0;i<26;i++) if(a[i].count>max) max=a[i].count; return(max); } void main() { int m,h=0; scanf("%d",&m); int i,j,n,l[1000],book_name[1000]; char author_name[1000][27]; for(i=0;i<26;i++) { aut[i].name='A'+i; aut[i].count=0; } for(i=0;i<m;i++) { scanf("%d%s",&book_name[i],author_name[i]); l[i]=strlen(author_name[i]); for(j=0;j<26;j++) for(n=0;n<l[i];n++) if(author_name[i][n]==aut[j].name) aut[j].count++; } for(i=0;i<26;i++) { if(aut[i].count==max(aut)) { printf("%c\n",aut[i].name); h=i; } } printf("%d\n",max(aut)); for(i=0;i<m;i++) { l[i]=strlen(author_name[i]); for(n=0;n<l[i];n++) if(author_name[i][n]==aut[h].name) printf("%d\n",book_name[i]); } }
2
887
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; } }
2
888
int main() {char ma='A'; int cnt[128]={0}; int i,j,n; struct s {int id; char au[27]; }bk[1000]; 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]!='\0';j++) {cnt[bk[i].au[j]]++; if(cnt[bk[i].au[j]]>cnt[ma]){ma=bk[i].au[j];} } } printf("%c\n%d\n",ma,cnt[ma]); for(i=0;i<n;i++) { if(strchr(bk[i].au,ma)){printf("%d\n",bk[i].id);} } return 0; }
2
889
struct x{ int num; char author[26]; int amount; }; void main(){ struct x y[999]; int i,j,m,max=0,max_=0; int k; int amount[91]={0}; scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d %s",&y[i].num,y[i].author); y[i].amount=strlen(y[i].author); } for(i=0;i<m;i++){ for(j=0;j<y[i].amount;j++){ for(k='A';k<'Z';k++){ if(k=y[i].author[j]){ amount[k]++; break; } } } } for(i='A';i<'Z';i++){ if(max<amount[i]){ max=amount[i]; max_=i;//ASCII??max_????????? } } printf("%c\n",max_); printf("%d\n",max); for(i=0;i<m;i++){ for(j=0;j<y[i].amount;j++){ if(y[i].author[j]==max_){ printf("%d\n",y[i].num); } } } }
2
890
struct book { int id; char writer[26]; int length; }zz[999]; int main() { int n,i,j,k; int letter[26]={0}; int letter_book[26][999]={0}; cin>>n; for ( i = 0 ; i < n; i ++ ) { cin>>zz[i].id; cin>>zz[i].writer; zz[i].length=strlen(zz[i].writer); } for ( j = 0 ; j < n ; j ++ ) { for ( k = 0 ; k < zz[j].length ; k ++ ) { letter_book[zz[j].writer[k] - 'A'][letter[zz[j].writer[k] - 'A']] = zz[j].id; letter[zz[j].writer[k] - 'A'] ++; } } int max=0,t; for ( i = 0 ; i < 26 ; i ++ ) { if ( letter[i] > max ) { max = letter[i]; t = i; } } char m; m = 'A' + t ; cout<<m<<endl; cout<<max<<endl; for ( i = 0 ; i < max ; i ++ ) cout<<letter_book[t][i]<<endl; }
2
891
int a[26]={0} ;int n;int max;int hao; struct chushu { int num; char s[30]; struct chushu *next; }; struct chushu *create() { int j=0,q,i=0,k=0; struct chushu *head,*p1,*p2; p1=(struct chushu *)malloc(len); scanf("%d %s",&p1->num,p1->s); for (i=0;p1->s[i]!='\0';i++) { j=p1->s[i]-65; a[j]=a[j]+1; } head=p1;p2=p1; while(k<n-1) { k++; p2=p1; p1=(struct chushu *)malloc(len); scanf("%d %s",&p1->num,p1->s); for (i=0;p1->s[i]!='\0';i++) { j=p1->s[i]-65; a[j]=a[j]+1; } p2->next=p1; } p2=p1; p2->next=NULL; return (head); } /*void print(struct chushu *head) { struct chushu *p; p=head; while(p!=NULL) {printf("%d\n",p->num); p=p->next;} }*/ void search(struct chushu *head) { int i; struct chushu *p; p=head; while (p->next!=NULL) { for (i=0;p->s[i]!='\0';i++) { if (hao+65==p->s[i]) printf("%d\n",p->num); } p=p->next; } for (i=0;p->s[i]!='\0';i++) { if (hao+65==p->s[i]) printf("%d\n",p->num); } } void main() { int i; struct chushu *p; scanf("%d",&n); p=create(); max=0; //print(p); for (i=0;i<26;i++) { if (a[i]>max) { max=a[i]; hao=i; } } printf("%c\n",hao+65); printf("%d\n",max); search(p); }
2
892
int a[26][1000]; int ai[26]; void func() { int k,i,len; char str[27]; scanf("%d %s",&k,str); len=strlen(str); for(i=0;i<len;i++) { a[str[i]-'A'][ai[str[i]-'A']]=k; ai[str[i]-'A']++; } } int main() { memset(a,0,sizeof(a)); memset(ai,0,sizeof(ai)); int n,i,i0,max=0; scanf("%d",&n); while(n--) func(); for(i=0;i<26;i++) { if(ai[i]>max) {max=ai[i]; i0=i;} } printf("%c\n",i0+'A'); printf("%d\n",max); for(i=0;i<ai[i0];i++) printf("%d\n",a[i0][i]); }
2
893
struct book { int num; char aut[26]; }b[999]; void main() { int i,j,m,n,k,max,p; int a[26]={0},q[999]={0}; scanf("%d",&m); for(i=0;i<m;i++) scanf("%d %s",&b[i].num,b[i].aut); for(i=0;i<m;i++) { n=strlen(b[i].aut); for(j=0;j<n;j++) { k=b[i].aut[j]; a[k-65]++; } } for(i=1,max=a[0],p=0;i<26;i++) { if(a[i]>max) { p=i; max=a[i]; } } printf("%c\n%d",p+65,max); for(i=0;i<m;i++) { n=strlen(b[i].aut); for(j=0;j<n;j++) if(b[i].aut[j]==(p+65)) q[i]=1; } for(i=0;i<m;i++) if(q[i]==1) printf("\n%d",b[i].num); }
2
894
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; }
2
895
struct shu { int haoma; char b[26]; struct shu *next; }; int main() { int n,i,a[26],c[26][100],max; int *s,(*q)[100]; s=a; q=c; char m[26]; struct shu *head,*p; for(i=0;i<26;i++) a[i]=0; scanf("%d",&n); head=(struct shu *)malloc(n*sizeof(shu)); p=head; for(i=0;i<n-1;i++) { (p+i)->next=p+i+1; } (p+n-1)->next=0; p=head; for(;p!=0;) { scanf("%d %s",&p->haoma,p->b); strcpy(m,p->b); for(i=0;*(m+i)!='\0';i++) { *(*(q+*(m+i)-65)+*(s+*(m+i)-65))=p->haoma; //c[m[i]-65][a[m[i]-65]]=p->haoma; *(s+*(m+i)-65)+=1; //a[m[i]-65]++; } p=p->next; } max=0; for(i=0;i<26;i++) if(*(a+i)>max) { max=*(a+i); n=i; } printf("%c\n",n+65); printf("%d\n",*(a+n)); for(i=0;i<*(a+n);i++) { printf("%d\n",*(*(q+n)+i)); } }
2
896
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; }
2
897
void main() { int t=0,m,i,j,n,k,a[999],c[26]={0}; char b[999][999]; scanf("%d\n",&m); for(i=0;i<m;i++) scanf("%d %s",&a[i],b[i]); for(i=0;i<m;i++) { k=strlen(b[i]); for(j=0;j<k;j++) c[b[i][j]-'A']++; } for(j=0;j<26;j++) { if(t<c[j]) t=c[j]; } for(i=0;i<26;i++) { if(c[i]==t) { printf("%c\n",i+'A'); break; } } printf("%d\n",t); for(j=0;j<m;j++) { k=strlen(b[j]); for(n=0;n<k;n++) { if((b[j][n]-'A')==i) printf("%d\n",a[j]); } } }
2
898
int main(int argc, char* argv[]) { struct book{ int num; char author[27]; }B[1000]; char A; int m,i,j,a[26]={0},max; scanf("%d",&m); for(i=0;i<m;i++){ scanf("%d%s",&B[i].num,B[i].author); } for(i=0;i<m;i++){ for(j=0;;j++){ if(B[i].author[j]==0) break; else a[B[i].author[j]-65]++; } } max=a[0]; A=65; for(i=0;i<26;i++){ if(a[i]>max){ max=a[i]; A=i+65; } } printf("%c\n%d",A,max); for(i=0;i<m;i++){ for(j=0;;j++){ if(B[i].author[j]==0) break; if(B[i].author[j]==A) printf("\n%d",B[i].num); } } return 0; }
2
899
void main() { struct ts { int sl; char zz[30]; int zzsl; struct ts *next; }; struct ts *p1,*p2,*head; int i,j,k,m,n,max,zzzdnum,num[100]={0}; char zzzd; scanf("%d",&n); p1=p2=head=(struct ts *)malloc(sizeof(struct ts)); scanf("%d %s",&p1->sl,p1->zz); // p1->zzsl=strlen(p1->zz);//????? for(i=1;i<n;i++) { p1=(struct ts *)malloc(sizeof(struct ts)); scanf("%d %s",&p1->sl,p1->zz); p1->zzsl=strlen(p1->zz); p2->next=p1; p2=p1; } p1->next=0; for(i='A';i<='Z';i++) { p1=head; for(k=0;k<n;k++) { for(j=0;p1->zz[j]!='\0';j++) { if(p1->zz[j]==i)num[i]++; } p1=p1->next; } } max=0; for(i='A';i<='Z';i++) { max=max>num[i]?max:num[i]; } for(i='A';i<='Z';i++) { if(num[i]==max)zzzd=i;//???????? } printf("%c\n%d\n",zzzd,max); p1=head; zzzdnum=0; for(i=0;i<n;i++) { for(j=0;p1->zz[j]!='\0';j++) { if(p1->zz[j]==zzzd) { printf("%d\n",p1->sl); } } p1=p1->next; } }
2