求助!!!

B3843 [GESP202306 三级] 密码合规

AC_bee @ 2023-11-26 08:19:04

#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,sum;
int u;
char o[100001];
int main(){
    cin>>o;
    o[strlen(o)]=','; 
    for(int i=0;i<=strlen(o);i++){
        if(o[i]==','){
            if(d==1 && sum>=6 && sum<=12) {
                if((a==1 && b==1) || (a==1 && c==1) || (b==1 && c==1)){
                    if(e==0){
                        for(int j=u;j<i;j++) cout<<o[j];
                        cout<<"\n";
                        u=i+1;
                    } 
                } 
            }
            sum=a=b=c=d=e=0;    
            continue;
        }   
        if(o[i]>='A' && o[i]<='Z') a=1;
        else if(o[i]>='a' && o[i]<='z') b=1;
        else if(o[i]>='0' && o[i]<='9') c=1;
        else if(o[i]=='#' || o[i]=='!' || o[i]=='$' || o[i]=='@') d=1;
        else e=1;
        sum++;
    }
    return 0;
} 

|