All challenges
Easy 0 solved 0% acceptance

Password Rules Check

Check a password against simple strength rules.

Problem

A password is strong if it has at least 8 characters, at least one uppercase letter, at least one lowercase letter and at least one digit (English letters and 0–9).

Implement is_strong_password(password).

Input

password: The password to check (ASCII characters).

Output

Return true if all rules hold, otherwise false.

Constraints

0 ≤ length of password ≤ 100

Examples

Example 1
Input:
password = "Secret123"

Expected output:
expected = True
Input:
std::string password = "Secret123";

Expected output:
bool expected = true;
Input:
string password = "Secret123";

Expected output:
bool expected = true;

Explanation

9 characters with uppercase S, lowercase letters and digits: strong.

Example 2
Input:
password = "password1"

Expected output:
expected = False
Input:
std::string password = "password1";

Expected output:
bool expected = false;
Input:
string password = "password1";

Expected output:
bool expected = false;

Explanation

There is no uppercase letter, so it is not strong.

References

This challenge is adapted for CodeUtility. Follow the statement and constraints above.

Learn from others

Community solutions

No published solutions yet. Solve this challenge to share the first one.