#include <bits/stdc++.h>
using namespace std;
string x, res;
string dp[2610][2610];
int n;
string rec(int l, int r) {
  string &res = dp[l][r];
  if (res == "") {
    if (l == r)
      res = x[l];
    else if (l > r)
      res = "";
    else {
      if (x[l] == x[r])
        res = x[l] + rec(l + 1, r - 1) + x[r];
      else {
        res = rec(l + 1, r);
        if (rec(l, r - 1).size() > res.size()) res = rec(l, r - 1);
        if (rec(l + 1, r - 1).size() > res.size()) res = rec(l + 1, r - 1);
      }
    }
  }
  return res;
}
int main() {
  cin >> x;
  n = x.size();
  if (n > 2600) {
    vector<pair<int, int> > l(26);
    for (int i = 0; i < 26; ++i) l[i].second = i;
    for (int i = 0; i < n; ++i) l[x[i] - 'a'].first++;
    sort(l.begin(), l.end());
    char ch = 'a' + l[25].second;
    for (int i = 0; i < 100; ++i) res += ch;
  } else {
    res = rec(0, n - 1);
    if (res.size() > 100) {
      string res1;
      int w = res.size() / 2, g = 0;
      if (res.size() % 2) g = 1;
      for (int i = 0; i < 50; ++i) {
        res1 += res[w + i + g];
        res1 = res[w - i - 1] + res1;
      }
      res = res1;
    }
  }
  cout << res << endl;
  return 0;
}
