func_code_string: #include <bits/stdc++.h>   using namespace std;   const double pi = 2 * acos(0.0);   const int inf = 0x3f3f3f3f;   const double infd = 1.0 / 0.0;   long long power(long long x, long long y, long long MOD) {     long long res = 1;     x = x % MOD;     while (y > 0) {       if (y & 1) res = (res * x) % MOD;       y = y >> 1;       x = (x * x) % MOD;     }     return res;   }   long long mul(long long a, long long b, long long MOD) {     if (b == 1) {       return a;     }     if (b % 2 == 0) {       return 2 * (mul(a, b / 2, MOD) % MOD);     } else {       return (a + (2 * (mul(a, b / 2, MOD)) % MOD)) % MOD;     }   }   bool ispow2(long long n) {     if (((n & (n - 1)) == 0) && n != 0) {       return true;     }     return false;   }   bool prime(int x) {     if (x == 1) {       return false;     }     if (x == 2) {       return true;     }     if (x % 2 == 0) {       return false;     }     for (int i = 3; i * i <= x; i += 2) {       if (x % i == 0) {         return false;       }     }     return true;   }   int __gcd(int a, int b) {     if (b == 0) return a;     return __gcd(b, a % b);   }   int coprime(int a, int b) {     if (a == b) return 0;     if (prime(a) && prime(b)) return 1;     if ((a == 2 && b % 2 != 0) || (b == 2 && a % 2 != 0)) return 1;     if ((a % 2 != 0 && prime(b) && a < b) || (b % 2 != 0 && prime(a) && a > b))       return 1;     if (abs(a - b) == 1) return 1;     if (a == 1 || b == 1) return 1;     return __gcd(a, b);   }   unsigned long long lcm(unsigned a, unsigned b) {     return ((unsigned long long)a) * (b / __gcd(a, b));   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n, diff;     string s;     cin >> n;     cin >> s;     map<int, int> m;     int ans = 0;     m[0] = -1;     diff = 0;     for (int i = 0; i < n; i++) {       int tmp = (s[i] ==  0  ? -1 : 1);       diff += tmp;       if (m.find(diff) == m.end()) {         m[diff] = i;       }       ans = max(ans, i - m[diff]);     }     cout << ans << endl;     return 0;   }   