#K86927. Password Validator
Password Validator
Password Validator
In this problem, you are required to validate a list of passwords against a set of strict criteria. A password is deemed valid if and only if it meets all of the following conditions:
- Its length is at least characters (i.e., ).
- It contains at least one uppercase letter (matching pattern [A-Z]).
- It contains at least one lowercase letter (matching pattern [a-z]).
- It includes at least one digit (matching pattern [0-9]).
- It contains at least one special character from the set: \{!@#\$%\^&\*()\-+\}.
Input will be provided via standard input (stdin) and the result should be printed to standard output (stdout). Each password’s validity should be output as either "valid" or "invalid" on a separate line.
inputFormat
The first line of input contains a single integer , representing the number of passwords. Each of the following lines contains one password string.
outputFormat
Output lines, each containing either "valid" or "invalid", corresponding to whether the respective password meets all the requirements.## sample
7
Passw0rd!
password
P@ssw0rd
short!
A1@a
Aa1@bcdefghijklmnop
12345Aa!
valid
invalid
valid
invalid
invalid
valid
valid
</p>