#include<iostream>
#include<string>
using namespace std;
int main() {
string str;
int letter=0,space=0,digit=0,other=0;
getline(cin,str);
for(int i=0; i<str.length(); i++) {
if(str[i]>=48&&str[i]<=57) digit++;
else if(str[i]>='A'&&str[i]<='Z'||str[i]>='a'&&str[i]<='z') letter++;
else if(str[i]==32) space++;
else other++;
}
cout<<letter<<' '<<space<<' '<<digit<<' '<<other<<endl;
}
C++ 统计字符个数
最新推荐文章于 2025-02-09 11:15:02 发布