Ctrl K

Password Rules Check

Easy
A service accepts a password only when it satisfies every rule at once: - it is at least 8 characters long; - it has at least one lowercase English letter; - it has at least one uppercase English letter; - it has at least one digit; - it has at least one special character from !@#$%^&*()-+; - no two equal characters stand next to each other (aa is not allowed, aba is fine). Given the string password, return True if it passes the check and False otherwise.
Example 1
password='Sunny#Day7' → False

10 characters, lowercase and uppercase letters, the digit 7 and the sign #, and no equal neighbours.

Example 2
password='Coffee+42' → False

Everything is there except one rule: "ff" and "ee" are equal characters side by side.

Example 3
password='Ab3$' → False

Every kind of character is present, but the length is only 4.

Constraints
  • 1 ≤ password.length ≤ 100
  • password consists of English letters, digits and the characters !@#$%^&*()-+
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsValue of a Roman Numeral EasyShared Start of Words EasyBracket Balance EasyWhere the Fragment Starts EasyLength of the Final Word Easy
loading Python…
Input
password='Sunny#Day7'
Expected
False

Run checks the first 3 tests in your browser. Submit checks all 6 tests on the server, hidden ones included.