func_code_string: #include <bits/stdc++.h>   template <typename T>   inline void read(T &x) {     bool b = 0;     char c;     while (!isdigit(c = getchar()) && c !=  - )       ;     if (c ==  - ) c = getchar(), b = 1;     x = c - 48;     while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + c - 48;     if (b) x = -x;   }   template <typename T>   inline void write(T x) {     if (x > 9) write(x / 10);     putchar(x % 10 + 48);   }   using namespace std;   const int N = 1e5 + 11;   int n, pos1, pos0, a[N], ans[N], ke[N], num[2];   int Max0(int pos) {     int res = 0;     for (int i = 1; i <= pos; i++) {       num[a[i]]++;       if (a[i])         res++;       else         res = max(res, num[0]);     }     num[0] = num[1] = 0;     return res;   }   int Max1(int pos) {     int res = 0;     for (int i = 1; i <= pos; i++) {       num[ans[i]]++;       if (ans[i])         res++;       else         res = max(res, num[0]);     }     num[0] = num[1] = 0;     return res;   }   int main() {     char c;     while (isdigit(c = getchar())) a[++n] = c - 48;     for (int i = 1; i <= n; i++) ans[i] = a[i];     ke[n + 1] = n;     ke[n] = n;     for (int i = n - 1; i > 0; i--) {       if (a[i] == a[i + 1])         ke[i] = ke[i + 1];       else         ke[i] = i;     }     for (int i = 1; i <= n; i++)       if (a[i]) {         pos1 = i;         break;       }     while (pos1 <= n) {       pos0 = ke[pos1] + 1;       int num0 = ke[pos0] - pos0 + 1;       int num1 = ke[pos1] - pos1 + 1;       if (num0 < num1) {         num1 -= num0;         for (int i = 1; i <= num1; i++) {           ans[pos1 + i - 1] = 0;           if (Max0(pos1 + i - 1) != Max1(pos1 + i - 1) || Max0(n) != Max1(n))             ans[pos1 + i - 1] = 1;         }       }       pos1 = ke[pos0] + 1;     }     for (int i = 1; i <= n; i++) cout << ans[i];   }   