help!!!!!!!!!!!!!!!!!!
查看原帖
help!!!!!!!!!!!!!!!!!!
1314279
MichaelMao楼主2024/12/1 15:18
#include<bits/stdc++.h>
using namespace std ;
string a[105] ;
int main()
{
    string s ; 
    cin >> s ;
    int l = s.size() , last = 0 , c = 0 , cnt = 0 ;
    for (int i = 0 ; i < l ; i ++)
    {
        if(s[i] == ','){
            c ++ ;
            a[c] = s.substr(last , i - 1) ;
            last = i + 1 ;
            cnt ++ ;
        } 
    }
    for (int i = 1 ; i <= cnt ; i ++)
    {
        int l1 = a[i].size() ;
        bool flag = 1 ;
        if(!(l1 >= 6 && l1 <= 12)) flag = 0 ;
        int s = 0 , b = 0 , n = 0 , p = 0 ;//分别是小写、大写字母,数字,特殊符号
        for(int j = 0 ; j < l1 ; j ++)
        {
            if(a[i][j] >= 'a' && a[i][j] <= 'z') s = 1 ;
            else if(a[i][j] >= 'A' && a[i][j] <= 'Z') b = 1 ;
            else if(a[i][j] >= '0' && a[i][j] <= '9') n = 1 ;
            else if(a[i][j] == '!' || a[i][j] == '#' || a[i][j] == '@' || a[i][j] == '$') p = 1 ;
            else flag = 0 ;
            if(s + b + n >= 2 && flag == 1 && p == 1) cout << a[i] << endl ;
        }
    }
    return 0 ;
}

本人无能,做到崩溃了,求大佬指教

2024/12/1 15:18
加载中...