#include <iostream>
#include<cstring>
using namespace std;
int main()
{
char s[1000];
int big=0,small=0,digit=0,blank=0,other=0;
cout<<"Please input three lines word:";
gets(s);
for(int i=0;i<strlen(s);i++)
{
if(s[i]>='a'&&s[i]<='z') small++;
else if(s[i]>='A'&&s[i]<='Z') big++;
else if(s[i]>='0'&&s[i]<='9') digit++;
else if(s[i]==' ') blank++;
else other++;
}
cout<<"big letter="<<big<<endl;
cout<<"small letter="<<small<<endl;
cout<<"digit="<<digit<<endl;
cout<<"blank="<<blank<<endl;
cout<<"other="<<other;
return 0;
}
输出结果: