Problem
You are given a password string p. Validate it against a set of rules and return all rules that the password violates.
Rules
-
Length
must be
greater than 15
characters.
-
Must
not
contain the substring
"password"
(case-insensitive). For example,
"MyPassWord123"
violates this rule.
-
Must contain
at least one uppercase
letter (
A-Z
) and
at least one lowercase
letter (
a-z
).
-
Must contain
at least one
character from a given set of
three special symbols
(the set will be provided by the interviewer; e.g.,
{!, @, #}
).
-
No character
may repeat
more than 4 times consecutively
(e.g.,
"aaaaa"
violates;
"aaaa"
is OK).
Input
-
A string
p
.
-
A set/list of exactly 3 allowed special characters.
Output
-
A list of violated rules (as strings or codes) in a deterministic order (e.g., rule number order).
Notes
-
If the password is fully compliant, return an empty list.
-
Treat the "password" check as case-insensitive.