int main()
{
char str[100],*p;
int cout[4]={0};
scanf("%[^\n]",&str);
p=str;
while(*p)
{
if((*p>='A'&&*p<='Z')||(*p>='a'&&*p<='z'))
cout[0]++;
else if(*p==' ')
cout[1]++;
else if(*p>='0'&&*p<='9')
cout[2]++;
else
cout[3]++;
p++;
}
printf("\nletter=%d,blank=%d,number=%d,other=%d\n",cout[0],cout[1],cout[2],cout[3]);
return 0;
}
温馨提示:答案为网友推荐,仅供参考