Problema
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.
Restrições
0 ≤ length of password ≤ 100
Exemplos
Entrada:
password = "Secret123"
Saída esperada:
expected = True
Entrada:
std::string password = "Secret123";
Saída esperada:
bool expected = true;
Entrada:
string password = "Secret123";
Saída esperada:
bool expected = true;
Explicação
9 characters with uppercase S, lowercase letters and digits: strong.
Entrada:
password = "password1"
Saída esperada:
expected = False
Entrada:
std::string password = "password1";
Saída esperada:
bool expected = false;
Entrada:
string password = "password1";
Saída esperada:
bool expected = false;
Explicação
There is no uppercase letter, so it is not strong.
Como abordar
Tente sozinho primeiro e depois abra uma dica de cada vez.
Dica 1
The password must satisfy several independent conditions at once.
Dica 2
Track whether you have seen an uppercase letter, a lowercase letter, and a digit while checking length.
Dica 3
An empty string or short string fails immediately even if it contains mixed characters.
Complexidade esperada
O(n) time, O(1) extra space
Referências
Este desafio foi adaptado para o CodeUtility. Siga o enunciado e as restrições acima.