cswork / OAOpen practice workspace

WayfairOA #4

Validating Magical Binary Strings with RegEx (NG)

Estimated EasyJudge-ready

Topics (AI-labelled)Strings

Determine whether a binary string starts with 1, contains at least two 0s, and has an even total number of 0s.

The standard input/output format and any supplementary ranges on this site are as stated in this problem.

Input

The first line contains q (1≤q≤1000), followed by q lines, each a binary string of length 1..1000.

Output

For each string, output True or False on its own line.

Example 1

Input:

1
1001

Output:

True

Example 2

Input:

1
11000

Output:

False

Example 3

Input:

1
0101

Output:

False

Editorial

Loading solution…