#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
int n, cnt[33], dp[2666][2666];
pair<int, int> par[2666][2666];
char second[maxn];
int calc(int l, int r) {
  if (l > r) return 0;
  if (l == r) return 1;
  int &res = dp[l][r];
  if (res != -1) return res;
  res = -mod;
  if (second[l] == second[r]) {
    res = calc(l + 1, r - 1) + 2;
    par[l][r] = make_pair(l + 1, r - 1);
  }
  if (calc(l + 1, r) > res) {
    res = calc(l + 1, r);
    par[l][r] = make_pair(l + 1, r);
  }
  if (res < calc(l, r - 1)) {
    res = calc(l, r - 1);
    par[l][r] = make_pair(l, r - 1);
  }
  return res;
}
string path(int l, int r) {
  if (l > r) return "";
  if (l == r) {
    string cur = "";
    cur += second[l];
    return cur;
  }
  pair<int, int> p = par[l][r];
  int pl = p.first, pr = p.second;
  string ans = "";
  if (l != pl && r != pr) {
    ans = second[l] + path(pl, pr) + second[r];
  } else {
    ans = path(pl, pr);
  }
  return ans;
}
int main() {
  scanf("%s", second + 1);
  n = strlen(second + 1);
  for (int i = (1); i <= (n); ++i) {
    cnt[second[i] - 'a']++;
    if (cnt[second[i] - 'a'] == 100) {
      while (cnt[second[i] - 'a']--) cout << second[i];
      return 0;
    }
  }
  memset(dp, -1, sizeof(dp));
  calc(1, n);
  string ans = path(1, n);
  if (((int)(ans).size()) <= 100)
    cout << ans;
  else {
    int m = ((int)(ans).size());
    string ss = "";
    for (int i = (0); i <= (49); ++i) ss += ans[i];
    cout << ss;
    reverse((ss).begin(), (ss).end());
    cout << ss;
  }
}
