You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
523 B

#include<bits/stdc++.h>
using namespace std;
int main() {
string str;
//因为题目要求可能存在空格
getline(cin, str);
int a = 0, b = 0, c = 0, d = 0;
for (int i = 0; i < str.size(); i++) {
if (str[i] >= 'a' && str[i] <= 'z') a++;
else if (str[i] >= 'A' && str[i] <= 'Z') a++;
else if (str[i] == ' ') b++;
else if (str[i] >= '0' && str[i] <= '9') c++;
else d++;
}
cout << a << " " << b << " " << c << " " << d << endl;
return 0;
}