马超 • 4个月前
#include <bits/stdc++.h>
using namespace std;
int main() {
string a;
getline(cin, a);
int x = 0, y = 0, z = 0, s = 0;
for (int i = 0; i < a.size(); i++) {
if ('A' <= a[i] && a[i] <= 'Z') {
x++;
} else if ('a' <= a[i] && a[i] <= 'z') {
y++;
} else if ('0' <= a[i] && a[i] <= '9') {
z++;
} else {
s++;
}
}
cout << x << " " << y << " " << z << " " << s << " " << a.size();
return 0;
}
评论:
请先登录,才能进行评论