Medium Divide and Conquer > Greedy

A binary string is balance string if,<br> 1. Number of 1's and 0's are same.<br> 2. For each prefix number of 1's should be greater or equal than number of 0's.<br> Example: 1100, 1010, 10110100 are balance string. 1001, 10101 are not balance string. Given a string binary S. Needs to find the max length of sub string S which is Balance String. Input: ------ Input starts with an integer T, denoting the number of test cases. Each case contains a binary string S. Output: ------- For each test case, output one line containing "Case x: “, where x is the test case number starting from 1, followed by the expected answer.See the sample I/O. 1 <= T <= 100<br> 1 <= |S| <= 10^5 Sample Input ------------ 2 10110100 100101010 Sample Output ------------- Case 1: 8 Case 2: 6

MD Musfiqur Rahman Sanim