#include <bits/stdc++.h>
using namespace std;
const int N = 2605;
string s, t, q;
map<char, int> d;
int f[N][N], n, y = 100;
deque<char> pr, sf;
int main() {
  cin >> s;
  n = s.length();
  if (n >= 2600) {
    for (char x : s) ++d[x];
    for (char x = 'a'; x <= 'z'; ++x)
      if (d[x] >= 100) {
        for (int j = 0; j < 100; ++j) cout << x;
        return 0;
      }
  }
  for (int i = 0; i < n; ++i) f[i][i] = 1;
  for (int i = 0; i < (n - 1); ++i) f[i][i + 1] = 1 + (s[i] == s[i + 1]);
  for (int i = 2; i < n; ++i)
    for (int j = 0; (j + i) < n; ++j)
      f[j][j + i] = max(max(f[j][j + i - 1], f[j + 1][j + i]),
                        f[j + 1][j + i - 1] + (s[j] == s[j + i]) * 2);
  int l = 0, r = n - 1;
  while (l <= r) {
    while ((l + 1) < n && f[l + 1][r] == f[l][r]) ++l;
    while (r && f[l][r - 1] == f[l][r]) --r;
    pr.push_back(s[l]);
    if (f[l][r] >= 2) sf.push_back(s[r]);
    ++l, --r;
  }
  while (y && (pr.size() || sf.size())) {
    if (y && pr.size()) {
      t.push_back(pr.front());
      pr.pop_front();
      --y;
    }
    if (y && sf.size()) {
      q.push_back(sf.front());
      sf.pop_front();
      --y;
    }
  }
  reverse(q.begin(), q.end());
  cout << t << q;
  return 0;
}
