spoj#DYZIO. Dyzio
Dyzio
Dyzio is Jasiek's friend and he also likes riddles. Here is a riddle he came up with:
Unfortunately mom hid the scissors from Jasiek, but luckily a computer was at hand and Jasiek quickly wrote a program simulating the rope cutting. Can you write such a program?
Task
Write a program which
- reads (from standard input) description of the way the rope is cut,
- counts how many cuts have to be made in order to get the first shortest piece.
- writes out the outcome (to standard output)
Input
Ten test cases (given one under another, you have to process all!). Each test case consists of two lines. In the first line there is a number n (1<=n<=20000). In the second line one zero-one word (a sequence of zeros and ones without spaces between them) of length n - the description of the cutting procedure given by Dyzio.
Output
For every testcase your program should write (to the standard output) only one line with one integer equal to the number of cuts which have to be made in order to get the shortest piece.
Example
Input: 9 110011000 [and 9 test cases more] Output: 4 [and 9 test cases more]