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: #include <bits/stdc++.h>
using namespace std;
#define int long long
 
bool solve(int k, string &s){
    bool a = true, b = true;
	for(int i = 0; i < s.size(); i++){
		if (i >= k || i + k < s.size()) continue;
		a &= (s[i] == '0');
		b &= (s[i] == '1');
	}
	return a||b;
}
 
signed main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
	int l = 1, r = n, ans = 1;
	while(r >= l){
		int k = (l + r)/2;
		if(solve(k, s)){
            ans = k;
            l = k + 1;
        }
		else r = k - 1;
	}
	cout << ans;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?