【输入样例】
aaaaa 111111 2223wwww
【输出样例】
letter=9
space=2
digit=9
other=0
#include<iostream>
using namespace std;
int main()
{
char a;
int letter,space,digit,other;
while((a=getchar())!='\n')**//输入字符当输入的字符为会车时结束输入**
{//由ascll码来判断字符的类型
if((a>=65&&a<=90)||(a>=97&&a<=122))
letter++;
else if(a==32)
space++;
else if(a>=48&&a<=57)
digit++;
else
other++;
}
cout<<"letter:"<<letter<<endl;//输出结果
cout<<"space:"<<space<<endl;
cout<<"digit:"<<digit<<endl;
cout<<"other:"<<other<<endl;
}