func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   string s;   int pre[N], nxt0[N], now = 100002;   int ans[N];   int n;   void init() {     vector<int> v;     for (int i = n - 1; i >= 1; i--) {       int p = s[i] -  0 ;       int pos = upper_bound(v.begin(), v.end(), -p) - v.begin();       if (pos == v.size()) {         v.push_back(-p);       } else {         v[pos] = -p;       }       ans[i] = v.size();     }   }   int main() {     ios::sync_with_stdio(false);     cin >> s;     s =  *  + s;     n = s.length();     init();     for (int i = 1; i < n; i++) pre[i] = pre[i - 1] + (s[i] ==  1 );     for (int i = n - 1; i >= 1; i--) {       nxt0[i] = now;       if (s[i] ==  0 ) now = i;     }     for (int i = 1; i <= n; i++) {       if (s[i] ==  0 ) continue;       if (s[i - 1] ==  1 ) continue;       int zuo1 = pre[i - 1], you1 = pre[n - 1] - pre[i],           you0 = (n - 1 - i) - you1;       int youmx = ans[nxt0[i]];       if (youmx <= you1) {         s[i] =  0 ;       }     }     for (int i = 1; i < n; i++) cout << s[i];   }   