X_mind
#include <iostream>
using namespace std;
int main()
{
string str;
int sumd=0,sumx=0,sumnull=0,sumnum=0,sumoth=0;
cout << "请输入一个字符串" << endl;
getline(cin,str);
for(int i=0;i<str.size();i++)
{
if(str[i]>='A'&&str[i]<='Z')
{
sumd++;
}else if(str[i]>='a'&&str[i]<='z')
{
sumx++;
}else if(str[i]>='0'&&str[i]<='9')
{
sumnum++;
}else if(str[i]==' ')
{
sumnull++;
}else
{
sumoth++;
}
}
cout << "sumd=" << sumd << endl << "sumx=" << sumx << endl << "sumnum=" << sumnum << endl << "sumnull=" << sumnull <<endl << "sumoth=" << sumoth << endl;
return 0;
}