#include <iostream>
using namespace std;
int main()
{
char c;
int letter=0,space=0,digh=0,other=0;
cout<<"请输入一行字符:";
while ((c=getchar())!='\n')//一开始是while (c=getchar()!='\n')非!=的运算优先级高于=,所以输出地c非0即1
{
if (c>='a'&&c<='z'||c>='A'&&c<='Z')
letter++;
else if(c==' ')
space++;
else if(c>='0'&&c<='9')
digh++;
else
other++;
}
cout<<"letter:"<<letter<<"space:"<<space<<"digh:"<<digh<<"other:"<<other<<endl;
return 0;
}