Password codechef solution in c++

#include <iostream>
#include <cstring>

using namespace std;

int main() {
    const int MAX_LENGTH = 100;
    char password[MAX_LENGTH];

    // Input the password
    cin >> password;

    // Check if the length of the password is at least 10 characters
    if (strlen(password) < 10) {
        cout << "Weak Password" << endl;
        return 0;
    }

    // Check if the password contains at least one uppercase letter
    bool hasUpperCase = false;
    for (int i = 0; i < strlen(password); i++) {
        if (isupper(password[i])) {
            hasUpperCase = true;
            break;
        }
    }

    // Check if the password contains at least one lowercase letter
    bool hasLowerCase = false;
    for (int i = 0; i < strlen(password); i++) {
        if (islower(password[i])) {
            hasLowerCase = true;
            break;
        }
    }

    // Check if the password contains at least one digit
    bool hasDigit = false;
    for (int i = 0; i < strlen(password); i++) {
        if (isdigit(password[i])) {
            hasDigit = true;
            break;
        }
    }

    // Check if the password contains at least one special character
    bool hasSpecialChar = false;
    for (int i = 0; i < strlen(password); i++) {
        if (!isalnum(password[i])) {
            hasSpecialChar = true;
            break;
        }
    }

    // Output the result based on the password criteria
    if (hasUpperCase && hasLowerCase && hasDigit && hasSpecialChar) {
        cout << "Strong Password" << endl;
    } else {
        cout << "Weak Password" << endl;
    }

    return 0;
}