标签:
2 abbccc adfadffasdf
c 3 f 4
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 using namespace std; 5 6 char ch[1005]; 7 8 int main() { 9 int n; 10 cin >> n; 11 while(n--) { 12 scanf("%s",ch); 13 int qua[26]={0}; 14 for(int i=0; i<strlen(ch); i++) { 15 qua[ch[i]-‘a‘]++; 16 } 17 int max=0,t; 18 for(int i=0; i<26; i++) { 19 if(qua[i]>max) { 20 max=qua[i]; 21 t=i+‘a‘; 22 } 23 } 24 printf("%c %d\n",t,max); 25 } 26 return 0; 27 }
标签:
原文地址:http://www.cnblogs.com/liangyongrui/p/4332926.html