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 string cutting. Can you write such a program?
Task
Write a program which
 reads (from standard input) description of the way the string 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 zeroone 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]
hide comments
dwij28:
20170924 01:18:04
To get accepted in Python, use sys.setrecursionlimit(20000), otherwise it will end up in an NZEC. Got several NZECs due to that. Also use, try catch in an infinite loop with break on exception while reading input. 

ashishranjan28:
20161217 07:54:02
easy recursion :) 

Anubhav Gupta:
20150921 06:59:26
Done without recursion :) 

(Tjandra Satria Gunawan)(æ›¾æ¯…æ˜†):
20150818 09:49:58
For those who confuse / didn't completely understand problem description you can go to forum (discuss) and search "DYZIO" there are clear sample case explanation by tripleM on the forum. 

agaurav77:
20150111 14:29:20
As tainic says, indeed, this one is a beautiful question. :) 

Rishav Goyal:
20140528 16:59:26
how to put this problem in tutorial :) 

John and the cows:
20130815 13:44:50
length(string) div 2+1, I think ???? 

Sayan Paul:
20130516 02:58:11
how to divide a string in half when its length is odd 

aman jain:
20130515 20:40:22
can someone explain how to cut and how we get 4 to test case given. 

tainic:
20120503 22:04:05
Nice! This goes into my list of beautiful problems. 
Added by:  Adam Dzedzej 
Date:  20040610 
Time limit:  1.903s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 
Resource:  Internet Contest Pogromcy Algorytmow (Algorithm Tamers) Round III, 2003 