文章

81

粉丝

2

获赞

444

访问

8.1k

头像
字符分类 题解:
P1016 兰州大学/贵州大学机试题
发布于2026年3月11日 22:25
阅读数 102

#include <iostream>
#include <string>
using namespace std;

int main(){

    string s;
    cin >> s;

    for(char c : s){
        if((c>='A' && c<='Z') || (c>='a' && c<='z'))
            cout << c;
    }
    cout << endl;

    for(char c : s){
        if(c>='0' && c<='9')
            cout << c;
    }
    cout << endl;

    for(char c : s){
        if(!((c>='A' && c<='Z') || (c>='a' && c<='z') || (c>='0' && c<='9')))
            cout << c;
    }

    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发