The control room of an experimental reactor requires every fail-safe override code to satisfy a strict compliance policy before the console will accept it. An override code is compliant only if all of the following hold:
0-9)!@#$%^&*()-+Given a candidate override code, decide whether it is compliant.
A single line containing the candidate override code — a non-empty string made only of lowercase letters, uppercase letters, digits, and the symbols !@#$%^&*()-+.
Print VALID if the code is compliant with every rule above, otherwise print INVALID.
!@#$%^&*()-+Example 1
Input
IronClad8+Launch
Expected
VALID
Explanation
"IronClad8+Launch" has length 16 (>= 8), contains lowercase letters (e.g. 'r', 'o', 'n'), uppercase letters ('I', 'C', 'L'), a digit ('8'), and a symbol from the panel ('+'). Scanning every adjacent pair of characters shows no two consecutive characters are equal. All six rules hold, so the code is VALID.
Example 2
Input
aaB2#test
Expected
INVALID
Explanation
"aaB2#test" contains lowercase letters, an uppercase letter ('B'), a digit ('2'), and a symbol ('#'), and has length 9 (>= 8). However, the first two characters are both 'a', so two adjacent characters are equal, which violates the no-repeat rule. Because at least one rule is violated, the code is INVALID.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →