用C语言设计一个程序

计算输入字符串每个字母的个数,只包括小写字母,举例输入字符串:aaaffeeee,结果输出:3a2f4e

#include <stdio.h>
typedef struct _word
{
    char w;
    int count;
} WORD;

int main()
{
    WORD word[26];
    for (int i = 0; i < 26; i++)
    {
        word[i].count = 0;
        word[i].w = 0;
    }
    char *s, str[100];
    scanf("%s", str);
    s = str;
    while (*s)
    {
        if (*s >= 'a' && *s <= 'z')
        {
            for (int i = 0; i < 26; i++)
            {
                if (word[i].w == *s)
                {
                    word[i].count++;
                    break;
                }
                else if (word[i].w == 0)
                {
                    word[i].w = *s;
                    word[i].count++;
                    break;
                }
            }
        }
        s++;
    }
    for (int i = 0; i < 26; i++)
    {
        if (word[i].count > 0)
            printf("%d%c", word[i].count, word[i].w);
    }
    printf("\n");
    system("pause");
    return 0;
}