For this Question: You are given a binary string S of length N. Suppose there is an integer K (1 <= K <= N). You can perform the following operation on the string any number of times (possible zero):

Select a substring in S whose size is <b>at least</b> K i. e, R − L + 1 >= K must be followed and flip this substring. Flipping here means if S<sub>i</sub> is equal to '1', make it equal to '0' and if S<sub>i</sub> is equal to '0', make it equal to '1'.

Find the maximum value of K such that you can make string S a null string. A null string is defined as a binary string in which all the characters are '0'.The first line of the input contains a single integer N.
The second line of the input contains a binary string of lenth N.

Constraints:
1 <= N <= 10<sup>5</sup>Print the maximum value of K such that you can make string S a null string.Sample Input:
3
010

Sample Output:
2

Explaination:
We can make S a null string by the following operations:
<ul>
<li>First, we pick the segment S[1,3] with length 3. S is now 101.</li>
<li>Next, we pick the segment S[1,2] with length 2. S is now 011.</li>
<li>And finally we pick the segment S[2,3] with length 2. S is now 000.</li>
</ul>, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main (String[] args) throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String[] str=br.readLine().split(" ");
        int m=Integer.parseInt(str[0]);
        String input=br.readLine();

        int n=input.length();
        int ans=n;

        for(int i=1; i<n; i++)
        {
            if(input.charAt(i-1) != input.charAt(i))
            {
                ans=Math.min(Math.max(i,n-i), ans);
            }
        }
        System.out.println(ans);
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?