OpenJudge

02:How many times to change?

总时间限制:
1000ms
内存限制:
65536kB
描述

Given a string composed of 0 and 1, you can flip a 0 to 1 and vice versa. Your task is to perform the flip operations to ensure that all the 0 are in front of 1.

For example, given a string 010001, you can flip the first 1 to 0 to transform the string 010001 to 000001. In this case, you need at least one flip operation to finish your task.

Given a string, how many flip operations you need at least to finish the task?

输入
The first line is an integer T, representing the number of cases. (1 ≤ T ≤ 10)
Each case contains a string S composed of 0 and 1. (1 ≤ |S| ≤ 1000)
输出
For each case, please output the least number of flip operations.
样例输入
3
000111
010001
100000 
样例输出
0
1
1

01 Use "long long" to calculate the answer
05 Expected Value of an Expression: Ai is less than 2^20

全局题号
15296
提交次数
79
尝试人数
43
通过人数
39