#include <stdio.h>
#define SMALL (str[i] >= 'a' && str[i] <= 'z')
#define CAPITAL (str[i] >= 'A' && str[i] <= 'Z')
int main(void)
{
char str[128];
int i;
int count[26] = {0};
printf("请输入一行字符:");
scanf("%s", str);
for (i = 0; str[i]; i++)
if (SMALL || CAPITAL)
++count[SMALL ? str[i] - 'a' : str[i] - 'A'];
printf("统计结果为:\n");
for (i = 0; i < 26; i++)
if (count[i])
printf("%c-%d\n", i + 'A', count[i]);
return 0;
}
#define SMALL (str[i] >= 'a' && str[i] <= 'z')
#define CAPITAL (str[i] >= 'A' && str[i] <= 'Z')
int main(void)
{
char str[128];
int i;
int count[26] = {0};
printf("请输入一行字符:");
scanf("%s", str);
for (i = 0; str[i]; i++)
if (SMALL || CAPITAL)
++count[SMALL ? str[i] - 'a' : str[i] - 'A'];
printf("统计结果为:\n");
for (i = 0; i < 26; i++)
if (count[i])
printf("%c-%d\n", i + 'A', count[i]);
return 0;
}