#K55322. Password Validator

    ID: 29950 Type: Default 1000ms 256MiB

Password Validator

Password Validator

You are given a list of passwords. Your task is to validate each password and determine if it meets the following requirements:

  • The password must be at least 8 characters long.
  • The password must contain at least one uppercase letter.
  • The password must contain at least one lowercase letter.
  • The password must contain at least one digit.
  • The password must contain at least one special character from the set: \( !@\#\$\%\^&\*()\-\+ \).

For each password, print "VALID" if it meets all the conditions and "INVALID" otherwise.

Input/Output Details:

The input will be read from stdin and the output should be written to stdout with each result on a new line.

inputFormat

The first line of input contains an integer \(T\) denoting the number of passwords to be validated. The following \(T\) lines each contain a string representing a password.

For example:

3
ValidPass1!
Another1@
StrongPass2$

outputFormat

For each test case (password), output a single line containing either VALID or INVALID, depending on whether the password meets the criteria.

For the example input above, the output should be:

VALID
VALID
VALID
## sample
3
ValidPass1!
Another1@
StrongPass2$
VALID

VALID VALID

</p>