求助 求助 帮助的大佬回关

B3843 [GESP202306 三级] 密码合规

qsbb @ 2024-09-03 20:54:21

#include<bits/stdc++.h>
using namespace std;
bool f[5];

int num = 0;
string s;
int main(){
    cin >> s;
    int sum = 0;
    bool fe = false;
    int j = 1;
    for(int i = 0; i <= s.size(); i++){
        string c;
        if(s[i] != ','){
            c[j] += s[i];
            j++;
            num ++;
            if(s[i] >= 'a' && s[i] <= 'z'){
                f[0] = true;
            }else if(s[i] >= 'A' && s[i] <= 'Z'){
                f[1] = true;
            }else if(s[i] >= '0' && s[i] <= '9'){
                f[2] = true;
            }else if(s[i] == '!' || s[i] == '@' || s[i] == '#' || s[i] == '$'){
                f[3] = true;
            }
        }else{
            for(int t = 0; t <4; t++){
                if(f[j] == true){
                    fe = true;
                }else{
                    fe = false;
                }
                f[i] = 0;
            }
            if(num >= 6 && num <= 12){
                fe = true;
            }else{
                fe = false;
            }
            if(fe == true){
                sum ++;
            }
            num = 0;
            j = 1;
        }
        if(fe == true){
            cout << c;
        }
    }
    return 0;
} //!@#$

|