文章
84
粉丝
408
获赞
33
访问
872.1k
#include<iostream>
#include<cstring>
using namespace std;
const int M = 1024;
int main()
{
char line[M];
cin.getline(line, M);
int num[4];
memset(num, 0, sizeof(num));
int i = 0;
while (line[i]) {
if (line[i] >= 'a' && line[i] <= 'z' || line[i] >= 'A' && line[i] <= 'Z')
num[0]++;
else if (line[i] >= '0' && line[i] <= '9')
num[1]++;
else if (line[i] == ' ')
num[2]++;
else
num[3]++;
i++;
}
cout << num[0] << " " << num[1] << " " << num[2] << " " << num[3] << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发