麦哥 • 1天前
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
getline(cin, s);
int upper = 0, lower = 0, space = 0;
for (char ch : s) {
if (ch >= 'A' && ch <= 'Z')
upper++;
else if (ch >= 'a' && ch <= 'z')
lower++;
else if (ch == ' ')
space++;
}
cout << upper << " " << lower << " " << space << endl;
return 0;
}
评论:
请先登录,才能进行评论