求助!!!

B3843 [GESP202306 三级] 密码合规

east_yue_chu @ 2024-07-26 16:26:40

0分求diao

#include<bits/stdc++.h>
using namespace std;
int l;//字符串起点 
int num;//其它 
int main()
{
    char s[105];
    cin>>s;
    for(int i=0;s[i]!='\0';i++)
    {
        int sum=0;
        int a=0,b=0,c=0,d=0;//小写字母,大写字母,数字,字符
        if(s[i+1]==',' || s[i+1]=='\0') 
        {
            if(i-l+1<6 || i-l+1>12)
            {
                l=i+2;
                continue;
            }
            else
            {
                for(int j=l;j<=i;j++)
                {
                    if(('a'<=s[j]&&s[j]<='z') || ('A'<=s[j]&&s[j]<='Z') || ('0'<=s[j]&&s[j]<='9') || (s[j]=='!') || (s[j]=='@') || (s[j]=='#') || (s[j]=='$'))
                    {
                        if(('a'<=s[j]&&s[j]<='z'))
                            a++;
                        if(('A'<=s[j]&&s[j]<='Z'))
                            b++;
                        if(('0'<=s[j]&&s[j]<='9'))
                            c++;
                        if((s[j]=='!') || (s[j]=='@') || (s[j]=='#') || (s[j]=='$'))
                            d++;
                        continue;
                    }
                    else
                    {
                        sum++;
                        break;
                    }
                }
                if(sum==0 && d!=0 && (a+b+c)>=2)
                {
                    num++;
                    if(num==1)
                    {
                        for(int j=l;j<=i;j++)
                            cout<<s[j];
                    }
                    else
                    {
                        cout<<endl;
                        for(int j=l;j<=i;j++)
                            cout<<s[j];
                    }
                }
                l=i+2;
                continue;
            }
        }
    }
    return 0;
}

|