求调,悬赏一坤元,能过样例但是wa,就一个测试点

B3843 [GESP202306 三级] 密码合规

cloud_drop @ 2024-11-05 00:15:12

#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int xiao=0,da=0,shu=0,fu=0,p=0,k=0;
    cin>>s;
    for(int i=0;i<100;i++){
        if(s[i]>='a'&&s[i]<='z')
            xiao++;
        else if(s[i]>='A'&&s[i]<='z')
            da++;
        else if(s[i]>='0'&&s[i]<='9')
            shu++;
        else if(s[i]=='!'||s[i]=='@'||s[i]=='#'||s[i]=='$')
            fu++;
        else if(s[i]==','){
            if(xiao+da+shu+fu>=6&&xiao+da+shu+fu<=12&&k!=1){
                if((xiao>0&&da>0)||(xiao>0&&fu>0)||(da>0||fu>0)){
                    for(p=i-xiao-da-fu-shu;p<i;p++){
                        cout<<s[p];
                    }
                    cout<<endl;
                    xiao=0,shu=0,da=0,fu=0,k=0;
                }
                else xiao=0,shu=0,da=0,fu=0;
            }
            else xiao=0,shu=0,da=0,fu=0;
        }
        else k=1;       
    } 
    return 0;
}

求大佬调


by 力巴尔 @ 2024-11-05 00:29:27


by Civilight_Eterna @ 2024-11-05 07:36:58

@cloud_drop 结尾没有逗号,你的程序结尾就没有输出


by cloud_drop @ 2024-11-05 12:39:12

@力巴尔 哥细说呗,私我一下vx号,我转一坤元


by cloud_drop @ 2024-11-06 23:58:10

@Civilight_Eterna 什么意思,不太懂


|