BETA
School Problem's Submission isn't counted in score!

Submissions: 1605 Accuracy:

29.91%

Check Binary String
       

Given a binary string of 0 and 1, write a program to check that the given string is valid or not. The given string is valid when there is no zero is present in between 1’s. For example, 1111, 0000111110, 1111000 are valid strings but 01010011, 01010, 101 are not.

Input:
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains a binary string.

Output:
For each test case print "VALID" without quotes if the string is valid otherwise print "INVALID" without quotes if the string is invalid.

Constraints:
1<=T<=100
2<=length(Str)<=105

Example:
Input:
3
100
1110001
00011
Output:
VALID
INVALID
VALID

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.