0分求调

B3843 [GESP202306 三级] 密码合规

aywuyichen2013 @ 2024-11-15 11:59:32

#include<bits/stdc++.h>
using namespace std;
string s,s1[105];
int i,j,k=0,x=0;
int main(){
    cin >>s,s+=',';
    for(i=0;i<s.size();i++){
        if(s[i]==',') s1[k]=s.substr(x,i-x),x=i+1,k++;
    }
    for(i=0;i<k;i++){
        int sum=0;
        if(s1[i].size()>=6 && s1[i].size()<=12){
            for(j=0;j<s1[i].size();j++){
                if((s1[i][j]>='0' && s1[i][j]<='9') || (s1[i][j]>='a' && s1[i][j]<='z') || (s1[i][j]>='A' && s1[i][j]<='Z') || s1[i][j]=='!'|| s1[i][j]=='@' || s1[i][j]=='#' || s1[i][j]=='$') sum++;
            }
            if(sum==s1[i].size()) cout<<s1[i]<<endl;
        }
    }
    return 0;
}

|