#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 123;
int n, k;
string s;
bool dp[maxn][maxn];
char good[maxn];
string trace(int i, int j) {
  if (i == 0) return "";
  int t = j;
  for (; t > 0; t -= t & -t) {
    int delta = t & -t;
    if (dp[i][j - delta]) return trace(i, j - delta);
  }
  if (dp[i - 1][j]) return trace(i - 1, j) + s[i + j];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  n = (int)s.size();
  s = " " + s;
  memset(dp, false, sizeof(dp));
  int len = 0, k = 0;
  int besti;
  while (len + (1 << k) < n) {
    len += (1 << k);
    ++k;
  }
  for (int i = 0; i <= n; i++) dp[0][i] = true;
  for (int i = 1; i <= n; i++) {
    char best = 'z';
    for (int j = 0; j + i <= n && j <= len; j++) {
      if (dp[i - 1][j]) best = min(best, s[i + j]);
    }
    for (int j = 0; j + i <= n && j <= len; j++)
      if (best == s[i + j] && dp[i - 1][j]) dp[i][j] = true;
    for (int j = 0; j + i <= n && j <= len; j++) {
      int t = j;
      for (; t > 0; t -= t & -t) {
        int delta = t & -t;
        if (dp[i][j - delta]) dp[i][j] = true;
      }
    }
  }
  cout << trace(n - len, len) << endl;
  return 0;
}
