#K1811. Minimum Operations to Remove Zeroes
Minimum Operations to Remove Zeroes
Minimum Operations to Remove Zeroes
You are given an integer T representing the number of test cases. For each test case, you are given a non-negative integer. Your task is to determine the minimum number of operations required to remove all zeroes in its decimal representation.
In one operation, you convert a digit (that is already zero)—effectively, the answer is the number of zeros present in the number. For example, if the number is given as \(1024\), it contains one '0', so the answer is 1.
Note: The number is provided in its usual decimal string form and may include leading or trailing zeros. For each test case, output the count of characters '0' in the number.
inputFormat
The first line of input contains a single integer T denoting the number of test cases. Each of the following T lines contains a single non-negative integer.
Example:
3 1024 305 9000
outputFormat
For each test case, print a single integer representing the minimum number of operations (i.e. the count of the digit '0' in the number). Each result should be printed on a new line.
Example:
1 1 3## sample
3
1024
305
9000
1
1
3
</p>