下面是一个示例代码:
#include <stdio.h>
int main() {
char str[100];
int letter = 0, space = 0, digit = 0, other = 0;
gets(str);
for (int i = 0; str[i] != '\0'; i++) {
if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) {
letter++;
} else