#include <bits/stdc++.h>
using namespace std;
int n;
string t;
struct data {
  int max_0 = 0;
  int max_1 = 0;
  int max_inc = 0;
  data() : max_0(0), max_1(0), max_inc(0) {}
  data(int m0, int m1, int m) : max_0(m0), max_1(m1), max_inc(m) {}
};
template <typename T>
class SegmentTree {
  vector<T> segtree;
  function<T(T, T)> combine;
  T inf;

 public:
  SegmentTree(int size, T _inf, function<T(T, T)> f) {
    inf = _inf;
    combine = f;
    segtree.resize(4 * size, inf);
  }
  void update(int u, int a, int b, int i, T x) {
    if (i < a || i > b) return;
    if (i >= b && i <= a) {
      segtree[u] = x;
      return;
    }
    update(u * 2, a, (a + b) / 2, i, x);
    update(u * 2 + 1, (a + b) / 2 + 1, b, i, x);
    segtree[u] = combine(segtree[u * 2], segtree[u * 2 + 1]);
  }
  void update(int i, T x) { update(1, 0, segtree.size() / 4 - 1, i, x); }
  T query(int u, int a, int b, int i, int j) {
    if (j < a || i > b || a > b) return inf;
    if (j >= b && i <= a) return segtree[u];
    return combine(query(u * 2, a, (a + b) / 2, i, j),
                   query(u * 2 + 1, 1 + (a + b) / 2, b, i, j));
  }
  T query(int i, int j) { return query(1, 0, segtree.size() / 4 - 1, i, j); }
};
void solve(int idx) {
  string s = t.substr(idx, 3);
  if (s == "000") {
    ;
  } else if (s == "001") {
    if (t[idx + 3] == '1') t[idx + 2] = '0';
  } else if (s == "010") {
    ;
  } else if (s == "011") {
    t[idx + 1] = '0';
    solve(idx);
  } else if (s == "100") {
    ;
  }
  if (s == "101") {
  }
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string s;
  cin >> s;
  n = s.size();
  SegmentTree<data> ST(n, data(0, 0, 0), [](data l, data r) {
    data res(0, 0, 0);
    res.max_0 = l.max_0 + r.max_0;
    res.max_1 = l.max_1 + r.max_1;
    res.max_inc = max({l.max_inc, r.max_inc, l.max_0 + r.max_inc, l.max_1,
                       r.max_0, l.max_inc + r.max_1});
    return res;
  });
  for (int i = 0; i < n; ++i) ST.update(i, data(s[i] == '0', s[i] == '1', 1));
  t = s;
  int overall_max = ST.query(0, n - 1).max_inc;
  for (int i = 0; i < n; ++i)
    if (t[i] == '1') {
      bool ok =
          max(ST.query(0, i - 1).max_inc - 1, ST.query(0, i - 1).max_0 + 1) +
              ST.query(i + 1, n - 1).max_inc ==
          overall_max;
      if (!ok) continue;
      t[i] = '0';
      ST.update(i, data(1, 0, 1));
    }
  cout << t << '\n';
}
