#求助大神解决问题,大一新生小白;
#我这样写为啥错了:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
char vocabulary[1000];
int shell[1000];
scanf("%s", vocabulary);
int i = 0;
int len = strlen(vocabulary);
for (i = 0; i < len; i++)
{
int d = vocabulary[i]; //对照Ascall码值 ;
if (d < 97)
{
d = d + 32; //如果检测到大写字母则将数值加32转化为小写字母;
}
shell[d]++;
}
int count;
int max = shell[97];
int maxnumber = 97;
for (count=98;count<= 122;count++)
{
if (shell[count] > max)
{
max = shell[count];
maxnumber = count;
}
else{
continue;
}
}
printf("%c\n", maxnumber);
printf("%d", max);
return 0;
}