#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   const long long MX = 1e9;   const long long INF = 1e9;   void solve() {     string s;     cin >> s;     int n = s.length(), mx[n + 1], c = 0;     for (int i = 0; i < s.length(); ++i) {       if (s[i] ==  1 )         ++c;       else if (c)         --c;       mx[i] = c;     }     mx[n + 1] = c;     for (int i = n - 1; i >= 0; --i) mx[i] = min(mx[i], mx[i + 1]);     int nz = 0;     for (int i = 0; i < n; ++i) {       if (s[i] ==  1 ) {         if (nz < mx[i + 1]) {           s[i] =  0 ;           ++nz;         }       }     }     cout << s <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     solve();     return 0;   }   