0pts 求救
查看原帖
0pts 求救
1286053
Nostopathy楼主2024/3/13 21:21
#include <iostream>
#include <string>
#include <cstring>
#define elif else if
using namespace std;

string s, s1 = "";

bool f (string s) {
    short i1, i2, it, ii;
    
    for (int i = 0; i < s.size(); i++) {
        if (s[i] >= 'a' and s[i] <= 'z') i1 = 1;
        elif (s[i] >= 'A' and s[i] <= 'Z') i2 = 1;
        elif (s[i] >= '0' and s[i] <= '9') it = 1;
        elif (s[i] == '!' or s[i] == '@' or s[i] == '#' or s[i] == '$') ii = 1;
        else return 0;
    }
    
    if (!ii) return 0;
    if (i1 + i2 + it <= 1) return 0;
    return 1;
}

signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    cin >> s;
    
    for (int i = 0; i < s.size(); i++) {
        if (s[i] != ',') {
            s1 += s[i];
        }
        else {
            if (f(s1)) cout << s1 << endl;
            s1 = "";
        }
    }
    
    return 0;
}

谢谢,QaQ

2024/3/13 21:21
加载中...