#K77122. Validate Code Patterns

    ID: 34795 Type: Default 1000ms 256MiB

Validate Code Patterns

Validate Code Patterns

In this problem, you are given several codes and you need to check whether each code satisfies the following conditions:

  1. The code must be exactly 6 characters long.
  2. The first character must be a letter (either uppercase or lowercase).
  3. The code must contain at least one digit.

If a code meets all the conditions, output VALID; otherwise, output INVALID.

For example, for the input code a1b2C3, the output should be VALID, while for abcdef it should be INVALID.

The formula for a valid code in LaTeX format is given as:

[ \text{code length} = 6,\quad \text{first character} \in [A-Za-z],\quad \exists , d \in \text{code} ; (d \in [0-9]). ]

inputFormat

The input starts with an integer (n) representing the number of codes. The following (n) lines each contain a single code string.

outputFormat

For each code, print a line containing either VALID or INVALID based on whether the code satisfies the conditions.## sample

4
a1b2C3
123456
abcdef
A12B34
VALID

INVALID INVALID VALID

</p>