解题思路:
注意事项:
参考代码:
#include<bits/stdc++.h>
using namespace std;
int main() {
string str;
getline(cin,str);
int al=0,dig=0,spa=0,other=0;
for(int i=0;i<str.size();i++){
if(isalpha(str[i]))al++;
else if(isdigit(str[i]))dig++;
else if(isspace(str[i]))spa++;
else other++;
}
cout<<al<<" "<<dig<<" "<<spa<<" "<<other;
return 0;
}
0.0分
0 人评分