#include <stdio.h>
#include <string.h>
void count(char c[]){
int letters=0,space=0,digit=0,other=0;
int i;
for (i = 0; c[i]; i++)
{
if(c[i]>='a'&&c[i]<='z'||c[i]>='A'&&c[i]<='Z')
letters++;
else if(c[i]==' ')
space++;
else if(c[i]>='0'&&c[i]<='9')
digit++;
else
other++;
}
printf("字母数:%d\n空格数:%d\n数字数:%d\n其他字符数:%d",letters
,space
,digit
,other
); }
int main(){
char c[32];
count(c);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4gCnZvaWQgY291bnQoY2hhciBjW10pewoJaW50IGxldHRlcnM9MCxzcGFjZT0wLGRpZ2l0PTAsb3RoZXI9MDsKCWludCBpOwoJZm9yIChpID0gMDsgY1tpXTsgaSsrKQoJewoJCWlmKGNbaV0+PSdhJyYmY1tpXTw9J3onfHxjW2ldPj0nQScmJmNbaV08PSdaJykKCQkJbGV0dGVycysrOwoJCWVsc2UgaWYoY1tpXT09JyAnKQoJCQlzcGFjZSsrOwoJCWVsc2UgaWYoY1tpXT49JzAnJiZjW2ldPD0nOScpCgkJCWRpZ2l0Kys7CgkJZWxzZQogICAgICAgICAgICAJb3RoZXIrKzsKCX0KCXByaW50Zigi5a2X5q+N5pWw77yaJWRcbuepuuagvOaVsO+8miVkXG7mlbDlrZfmlbDvvJolZFxu5YW25LuW5a2X56ym5pWw77yaJWQiLGxldHRlcnMsc3BhY2UsZGlnaXQsb3RoZXIpOwp9CmludCBtYWluKCl7CgljaGFyIGNbMzJdOwoJcHJpbnRmKCLor7fovpPlhaXkuIDooYzlrZfnrKbvvJpcbiIpOwoJZ2V0cyhjKTsKCWNvdW50KGMpOwoJcmV0dXJuIDA7Cn0K