#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
using namespace std;
const int inf = (int)1e9 + 99999, mod = (int)1e9 + 7;
const long long linf = (long long)2e18 + 99999;
int kob(int x, int y) { return ((long long)x * y) % mod; }
int aza(int x, int y) {
  x -= y;
  if (x < 0) return x + mod;
  return x;
}
int kos(int x, int y) {
  x += y;
  if (x >= mod) return x - mod;
  return x;
}
const int maxn = (int)1e5 + 777, maxn2 = (int)1e6 + 55;
static long holdrand = 1L;
void srand(unsigned int seed) { holdrand = (long)seed; }
int rand() {
  return (((holdrand = holdrand * 214013L + 2531011L) >> 16) & 0x7fff);
}
string s;
vector<int> v;
long long n, m, a[5234562];
int suf[3000][3];
int pr0[3000];
int pr1[3000];
vector<pair<int, int> > g;
int main() {
  cin >> s;
  s += "10";
  int n = s.size();
  for (int i = 0; i < s.size() - 1; i++)
    if (s[i] == '1' && s[i + 1] == '0') v.push_back(i), g.push_back({0, 0});
  for (int i = 0; i < v.size(); i++) {
    int last = 0;
    if (!i)
      last = 0;
    else
      last = v[i - 1] + 1;
    int cnt1 = 0;
    int cnt0 = 0;
    for (int j = last; j <= v[i]; j++) {
      if (s[j] == '0')
        cnt0++;
      else
        cnt1++;
    }
    if (i == v.size() - 1) cnt1--;
    g[i] = make_pair(cnt0, cnt1);
  }
  pr1[v.size() - 1] = g[v.size() - 1].second;
  pr0[v.size() - 1] = g[v.size() - 1].first;
  for (int i = v.size() - 2; i >= 0; i--) {
    pr1[i] = pr1[i + 1] + g[i].second;
    pr0[i] = pr0[i + 1] + g[i].first;
  }
  suf[v.size() - 1][0] = pr0[v.size() - 1] + pr1[v.size() - 1];
  suf[v.size() - 1][1] = pr1[v.size() - 1];
  for (int i = v.size() - 2; i >= 0; i--) {
    suf[i][1] = suf[i + 1][1] + g[i].second;
    suf[i][0] = max(suf[i + 1][0] + g[i].first,
                    suf[i + 1][1] + g[i].first + g[i].second);
  }
  string t = s;
  int len1 = 0;
  int len0 = 0;
  for (int i = 0; i < s.size() - 1; i++) {
    if (s[i] == '0') {
      len0++;
      t[i] = '0';
    } else {
      int pos = lower_bound(v.begin(), v.end(), i) - v.begin();
      int j = pos;
      pos = v[pos];
      if (i == pos) {
        len1 = max(len0 + 1, len1 + 1);
        continue;
      }
      int fst = suf[j + 1][1] + max(len1, len0 + 1) + g[j].second - 1;
      int snd = max(suf[j + 1][0] + len0 + 1, 0);
      if (max(fst, snd) == max(suf[0][0], suf[0][1]))
        t[i] = '0', len0++, g[j].second--;
      else
        t[i] = '1', len1 = max(len0 + 1, len1 + 1);
    }
  }
  t.pop_back();
  t.pop_back();
  cout << t;
}
