#include <iostream.h>
#include <string.h>
int main(){
const char alpha[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char sen[500];
int ch[25]={0},i,n,a,max=0;
cin>>n;
for (i=0;i<=n;i++){
cin.getline(sen,500,'\n');
for (a=0;a<(strlen(sen));a++){
if (sen[a]>='A' && sen[a]<='Z'){
ch[sen[a]-65]++;
if (ch[sen[a]-65]>max) max = ch[sen[a]-65];
}else if (sen[a]>='a' && sen[i]<='z'){
ch[sen[a]-97]++;
if (ch[sen[a]-97]>max) max = ch[sen[a]-97];
}
}
}
for (i=max;i>=1;i--)
for (a=0;a<=25;a++)
if (ch[a]==i) cout<<alpha[a]<<" "<<i<<endl;
return 0;
}
No comments:
Post a Comment