#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
char s[500010];
int n;
int dp[3010][3010];
pair<int, int> pre[3010][3010];
pair<int, int> ans;
int Max;
int dfs(int l, int r) {
  if (dp[l][r] != -1) return dp[l][r];
  if (l == r) return 1;
  if (l > r) return 0;
  int &ret = dp[l][r] = 0;
  if (s[l] == s[r]) {
    pre[l][r] = make_pair(l + 1, r - 1);
    ret = dfs(l + 1, r - 1) + 2;
  } else {
    if (dfs(l + 1, r) > ret) {
      ret = dfs(l + 1, r);
      pre[l][r] = make_pair(l + 1, r);
    }
    if (dfs(l, r - 1) > ret) {
      ret = dfs(l, r - 1);
      pre[l][r] = make_pair(l, r - 1);
    }
  }
  if (Max == 100) return ret;
  if (ret > Max) {
    Max = ret;
    ans = make_pair(l, r);
  }
  return ret;
}
vector<int> vec;
void Output() {
  int l = ans.first, r = ans.second;
  vec.clear();
  while (l <= r) {
    if (l == r) {
      vec.push_back(l);
      break;
    }
    pair<int, int> nxt = pre[l][r];
    if (nxt.first == l + 1 && nxt.second == r - 1) {
      vec.push_back(l);
      vec.push_back(r);
      if ((int)vec.size() == 100) break;
    }
    l = nxt.first, r = nxt.second;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < (int)vec.size(); i++) {
    printf("%c", s[vec[i]]);
  }
  cout << endl;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  n = min(n, 3000);
  memset(dp, -1, sizeof(dp));
  ans = make_pair(1, 1);
  Max = 0;
  dfs(1, n);
  Output();
  return 0;
}
