思路不难 纯练习稳定性

#include <iostream>
#include <cctype>
using namespace std;

int main() {
    string password;
    int score = 0;
    cin >> password;
    int n = password.size();

    //密码长度
    if(n <= 4) score += 5;
    else if(n <= 7) score += 10;
    else score += 25;

    bool has_upper = false, has_lower = false;
    int count_digit = 0, count_symbol = 0;
    for(const char& c: password) {
        if(islower(c)) has_lower = true;
        else if(isupper(c)) has_upper = true;
        else if(isdigit(c)) ++count_digit;
        else ++count_symbol;
    }

    bool has_one_alpha = (has_lower && !has_upper) || (!has_lower && has_upper);
    bool has_two_alpha = has_lower && has_upper;

    //字母
    if(has_two_alpha) score += 20;
    else if(has_one_alpha) score += 10;

    //数字
    if(count_digit > 1) score += 20;
    else if(count_digit == 1) score += 10;

    //符号
    if(count_symbol > 1) score += 25;
    else if(count_symbol == 1) score += 10;



    //奖励
    if(has_two_alpha && count_digit && count_symbol) score += 5;
    else if((has_lower || has_upper) && count_digit && count_symbol) score += 3;
    else if((has_lower || has_upper) && count_digit) score += 2;

    string ans;
    if(score >= 90) ans = "VERY_SECURE";
    else if(score >= 80) ans = "SECURE"; 
    else if(score >= 70) ans = "VERY_STRONG";
    else if(score >= 60) ans = "STRONG";
    else if(score >= 50) ans = "AVERAGE";
    else if(score >= 25) ans = "WEAK";
    else ans = "VERY_WEAK";
    cout << ans << endl;
    return 0;
}