#include <stdio.h>
int main() {
printf("请输入一串字符串:");
char z[100];
scanf("%s", z);
int letter = 0, number = 0, blank = 0, other = 0, i = 0;
while (z[i] !='\0') {
if ((z[i] >= 'a' && z[i] <= 'z') || (z[i] >= 'A' && z[i] <= 'Z')) {
letter++;
} else if (z[i] >= '0' && z[i] <= '9') {
number++;
} else if (z[i] == ' ') {
blank++;
} else {
other++;
}
i++;
}
printf("字母数量=%d\n数字数量=%d\n空格数量=%d\n其他=%d\n", letter, number, blank, other);
return 0;
}
