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
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.
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.
How to approach it
Try on your own first, then open one hint at a time.
Hint 1
The password must satisfy several independent conditions at once.
Hint 2
Track whether you have seen an uppercase letter, a lowercase letter, and a digit while checking length.
Hint 3
An empty string or short string fails immediately even if it contains mixed characters.
Expected complexity
O(n) time, O(1) extra space
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.