The Muskteers
Submissions: 1549   Accuracy:

27.46%

  Difficulty: Basic   Marks: 1

Aditi and Nandi are very good friends and never want to go far from each other. Their friendship is defined in a string of '0' and '1' . Help them to check that they are far from each other or not. There is only one way to check, all 0's should be together, it means they are not far from each other.

Input:
First line consists of the test case T. The only line of each test case consists of string , consisting of 0 and 1.

Output:
If they are not far from each other print "YES" else "NO".

Constraints:
1<=T<=100
1<=|Length of string|<=10000

Example:
Input:

3
000
111
0001110
Output:
YES
NO
NO

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

Contributor: Saksham Raj Seth
Author: saksham seth


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.



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


to report an issue on this page.