#C7382. Valid Variable Name Checker

    ID: 51247 Type: Default 1000ms 256MiB

Valid Variable Name Checker

Valid Variable Name Checker

You are given a string and you need to determine whether it is a valid variable name based on the following rules:

  • The string must be non-empty.
  • It can only contain uppercase and lowercase alphabetic characters and underscore ('_').
  • The string must contain at least one alphabetic character (i.e. after removing underscores, the string should be non-empty and only letters).
  • The string should not start or end with an underscore.
  • The string should not contain two consecutive underscores.

Your program should read multiple test cases from standard input. For each test case, print VALID if the given string satisfies all the rules above, otherwise print INVALID.

Note: If there is any violation of the rules, the variable name is considered invalid.

inputFormat

The first line of input contains an integer T representing the number of test cases. Followed by T lines, each line contains a single string that represents a potential variable name.

outputFormat

For each test case, output a single line containing either VALID or INVALID based on whether the string is a valid variable name.

## sample
3
valid_name
__invalid__
inValid
VALID

INVALID VALID

</p>