#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  vector<string> S(26);
  for (auto ch : s) {
    S[ch - 'a'] += ch;
    if (S[ch - 'a'].size() == 100) {
      cout << S[ch - 'a'] << endl;
      return 0;
    }
  }
  int n = s.size();
  int f[n + 1][n + 1];
  int g[n + 1][n + 1];
  for (int len = 1; len <= n; ++len)
    for (int i = 0; i + len - 1 < n; ++i) {
      if (len == 1)
        f[len][i] = 1;
      else if (len == 2 && s[i] == s[i + len - 1])
        f[len][i] = 2;
      else {
        int a = f[len - 1][i] < f[len - 1][i + 1] ? f[len - 1][i + 1]
                                                  : f[len - 1][i];
        if (f[len - 1][i] == a)
          g[len][i] = 0;
        else
          g[len][i] = 1;
        if (len > 2 && s[i] == s[i + len - 1] && 2 + f[len - 2][i + 1] > a) {
          a = 2 + f[len - 2][i + 1];
          g[len][i] = 2;
        }
        f[len][i] = a;
      }
    }
  vector<int> v;
  int len = n, x = 0;
  while (true) {
    if (len == 1) {
      v.push_back(x);
      break;
    }
    if (len == 2 && s[x] == s[x + len - 1]) {
      v.push_back(x);
      v.push_back(x + 1);
      break;
    }
    if (g[len][x] == 0)
      --len;
    else if (g[len][x] == 1) {
      --len;
      ++x;
    } else {
      v.push_back(x);
      v.push_back(x + len - 1);
      len -= 2;
      ++x;
    }
  }
  sort(v.begin(), v.end());
  int take = 50;
  for (int i = 0; i < v.size(); ++i)
    if (i < take || i + take >= v.size()) cout << s[v[i]];
  return 0;
}
