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.
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.
For each test case print "VALID" without quotes if the string is valid otherwise print "INVALID" without quotes if the string is invalid.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.