#K35422. Password Validator
Password Validator
Password Validator
Given a string s, determine if it is a valid password based on the following rules:
- The password length must be between 8 and 20 characters, inclusive.
- The password must contain at least one lowercase letter, one uppercase letter, one digit, and one special character from the set: !@#$%^&*()_+.
- The password should not contain any whitespace characters (such as spaces or tabs).
If the password is valid, print VALID
to the standard output; otherwise, print INVALID
.
Mathematically, the conditions can be expressed as: \(8 \leq |s| \leq 20\) and \(s\ \text{contains at least one lowercase letter, one uppercase letter, one digit, and one special character from} \{!@#$%^&*()_+\}\) and \(s\ \text{contains no whitespace}\).
inputFormat
The input is provided via standard input as a single line containing the string s
(the password to be validated).
outputFormat
Output VALID
if the password meets the requirements, otherwise output INVALID
. The output must be printed to the standard output.
Password123!
VALID
</p>