dotcpp0649853


私信TA

用户名:dotcpp0649853

访问量:86

签 名:

等  级
排  名 12057
经  验 953
参赛次数 0
文章发表 4
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

TA的其他文章

解题思路:

注意事项:

参考代码:

#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 人评分

  评论区