我已经被各种输入方法给搞晕了~~~
#include<iostream>
#include<string.h>
using namespace std;
void tongji(char A[])
{
int a=0,b=0,c=0,d=0;
for(int i=0;i<strlen(A);i++)
{
if(A[i]>='A'&&A[i]<='Z'||A[i]>='a'&&A[i]<='z')
a++;
else if(A[i]>='0'&&A[i]<='9')
b++;
else if(A[i]==' ')
c++;
else
d++;
}
cout<<a<<' '<<b<<' '<<c<<' '<<d<<' ';
}
int main()
{
char ans[1000];
gets(ans);
tongji(ans);
return 0;
}