#include<stdio.h> #include<string.h> int main() { char ch,arr[10000]; int i=0,j,k,l,n,m; while(scanf("%c",&ch)==1) { if(ch=='\n') { int num[55],max=0; for(j=0;j<52;j++) { num[j]=0; } for(j=0;j<i;j++) { if(arr[j]>='A'&&arr[j]<='Z') { m=arr[j]-65; (num[m])++; } else if(arr[j]>='a'&&arr[j]<='z') { m=arr[j]-70; (num[m])++; } } for(j=0;j<52;j++) { if(num[j]>max) { max=num[j]; } } i=0; for(j=0;j<52;j++) { if(num[j]==max) { if(j<26) { printf("%c",j+65); } else { printf("%c",j+70); } } } printf(" %d\n",max); } else { arr[i++]=ch; } } return 0; }
Sunday, August 24, 2014
uva - 499 - What's The Frequency, Kenneth?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment