#K84272. Minimum Moves to All Ones

    ID: 36383 Type: Default 1000ms 256MiB

Minimum Moves to All Ones

Minimum Moves to All Ones

You are given a list of binary strings. In one move, you can flip all characters of a string to '1'. That is, if the string already contains only '1's, no move is needed. Otherwise, only one move is required to change the string into a string of all '1's.

In other words, for each binary string \( s \) of length \( n \), the minimum number of moves required is given by:

[ \text{moves}(s) = \begin{cases} 0, & \text{if } s = 1\cdots1,\ 1, & \text{otherwise.} \end{cases} ]

Your task is to determine, for each given binary string, whether it requires a move (output 1) or not (output 0).

inputFormat

The first line contains an integer \( t \) (1 ≤ \( t \) ≤ 100), denoting the number of test cases.

Each of the next \( t \) lines contains a binary string \( s \) of length \( n \) (1 ≤ \( n \) ≤ 100) consisting only of characters '0' and '1'.

outputFormat

For each test case, print a single line containing one integer — the minimum number of moves required to convert the binary string into a string of all '1's.

## sample
3
111
1
11111
0

0 0

</p>