#include <bits/stdc++.h>
using namespace std;
char _;
int rnk[5005], nxt[5005][5005];
int hi, n, k;
string s;
vector<pair<pair<int, int>, int> > v;
void out(int N, int P) {
  if (N == 0) return;
  P = nxt[N][P];
  cout << s[k - N + P];
  out(N - 1, P);
}
int main() {
  cin >> s;
  if (s.size() == 1) {
    cout << s;
    return 0;
  }
  for (hi = 0; (1 << hi) < s.size(); ++hi)
    ;
  --hi;
  n = (1 << hi) - 1;
  memset(rnk, 0x3f3f3f3f, sizeof rnk);
  rnk[n] = 0;
  k = s.size() - n;
  for (int l = 0; l < k + 1; ++l) {
    for (int l2 = 0; l2 < n + 1; ++l2) {
      nxt[l][l2] = l2;
    }
    for (int l2 = n + 1 - 1; l2 >= 0; --l2) {
      for (int l3 = 0; (1 << l3) <= l2; ++l3) {
        if ((1 << l3) & l2) {
          rnk[l2 - (1 << l3)] = min(rnk[l2 - (1 << l3)], rnk[l2]);
          if (rnk[l2 - (1 << l3)] == rnk[l2])
            nxt[l][l2 - (1 << l3)] = nxt[l][l2];
        }
      }
    }
    if (l == k) {
      out(l, 0);
      return 0;
    }
    v.clear();
    for (int l2 = n + 1 - 1; l2 >= 0; --l2) {
      if (l + (n - l2) >= s.size()) break;
      v.push_back(
          make_pair(make_pair(s[s.size() - 1 - l - (n - l2)], rnk[l2]), l2));
    }
    memset(rnk, 0x3f3f3f3f, sizeof rnk);
    sort(v.begin(), v.end());
    int p = 0;
    for (int l = 0; l < v.size(); ++l) {
      if (l != 0 && v[l].first != v[l - 1].first) {
        ++p;
      }
      rnk[v[l].second] = p;
    }
  }
  return 0;
}
