文章
1
粉丝
503
获赞
0
访问
9.1k
#include <iostream>
#include <string>
using namespace std;
int main()
{
string str;
getline(cin, str);
int a=0, b=0, c=0, d=0;
int n = str.length();
for (int i = 0; i < n; i++)
{
if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A'&&str[i] <= 'Z'))
a++;
else if (str[i] >= '0'&&str[i] <= '9')
b++;
else if (str[i] == 32)
c++;
else d++;
}
cout << a << " " << b << " " << c << " " << d << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发