不多说了。上图:
aabbbcccddd
b 3
请按任意键继续. . .
正确的代码:
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
int main()
{
int a[26]={0};
char s[100];
int max=0,index=-1,i;
scanf("%s",&s);
for(i=0;i
a[s[i]-'a']++;
}
for(i=0;i<26;i++)
{
if(a[i]>max)
{
max=a[i];
index=i;
}
}
printf("%c %d\n",'a'+index,max);
system("pause");
}
GoodLuck!