#include <bits/stdc++.h>
using namespace std;
const int N = 5055;
const int LOG = 11;
const int MSK = (1 << LOG) + 10;
pair<int, int> dp2[N][MSK];
int rek[N][MSK];
int lg, n;
char s[N], miin[N];
vector<pair<int, pair<int, int> > > v;
vector<pair<pair<int, int>, int> > v2;
int getlen(int x, int msk) {
  int ret = x + 1;
  for (int i = 0; i < lg; i++) {
    if (msk & (1 << i)) ret -= (1 << i);
  }
  return ret;
}
void solve() {
  char ez = s[0];
  for (int i = 0; i < n; i++) {
    if (s[i] < ez) ez = s[i];
    miin[i] = ez;
    for (int j = 0; j < (1 << lg); j++) {
      if (i + 1 - j >= 1 && i + 1 - j <= n + 1 - (1 << lg))
        v.push_back(make_pair(i + 1 - j, make_pair(i, j)));
      if (i + 1 - j == 0) {
        dp2[i][j] = make_pair(0, 0);
        rek[i][j] = 0;
      }
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    int r = i;
    while (r < v.size() && v[r].first == v[i].first) r++;
    for (int j = i; j < r; j++) {
      int x = v[j].second.first;
      int msk = v[j].second.second;
      pair<int, int> sol = make_pair((x > 0) ? dp2[x - 1][msk].first : 0, s[x]);
      rek[x][msk] = -1;
      for (int k = 0; k < lg; k++) {
        if (!(msk & (1 << k))) continue;
        if (x - (1 << k) >= 0 && dp2[x - (1 << k)][msk - (1 << k)] < sol) {
          sol = dp2[x - (1 << k)][msk - (1 << k)];
          rek[x][msk] = k;
        }
        if (x - (1 << k) < 0) {
          sol = make_pair(0, 0);
          rek[x][msk] = k;
        }
      }
      dp2[x][msk] = sol;
      v2.push_back(make_pair(sol, j));
    }
    sort(v2.begin(), v2.end());
    int j = 0;
    for (int i = 0; i < v2.size(); i++) {
      if (i > 0 && v2[i].first != v2[i - 1].first) j++;
      dp2[v[v2[i].second].second.first][v[v2[i].second].second.second].first =
          j;
    }
    v2.clear();
    i = r - 1;
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  while ((1 << lg) <= n) lg++;
  lg--;
  solve();
  int x = n - 1, msk = (1 << lg) - 1;
  string sol = "";
  while (x >= 0) {
    if (rek[x][msk] == -1) {
      sol.push_back(s[x]);
      x--;
      continue;
    } else {
      int rm = (1 << rek[x][msk]);
      x -= rm;
      msk -= rm;
    }
  }
  reverse(sol.begin(), sol.end());
  cout << sol << endl;
}
