#include <bits/stdc++.h>
using namespace std;
map<long long, bool> visi;
int ar[1000001];
char str[100001], str2[1000001];
int table[5000][5000];
vector<int> vec;
int n;
void cal(int i, int j) {
  int mx;
  if (i > j) return;
  if (i == j) {
    vec.push_back(i);
    return;
  }
  mx = max(table[i][j - 1], table[i + 1][j]);
  if (mx == table[i][j]) {
    if (mx == table[i][j - 1])
      cal(i, j - 1);
    else
      cal(i + 1, j);
  } else {
    vec.push_back(i);
    vec.push_back(j);
    cal(i + 1, j - 1);
  }
}
int lol;
int main() {
  int i, j, m, a, c, b, d, ck, t, r, x, y, ans, rem, cnt, lo, hi, sum, cs = 1;
  scanf("%s", str);
  n = strlen(str);
  if (n > 3000) n = 3000;
  for (i = 0; i < n; i++) str2[i + 1] = str[i];
  str2[n + 1] = '\0';
  for (i = 1; i <= n; i++) table[i][i] = 1;
  ck = 0;
  for (i = 2; i <= n; i++) {
    x = 1;
    j = i;
    while (j <= n) {
      if (str2[x] == str2[j]) {
        table[x][j] = table[x + 1][j - 1] + 2;
        if (table[x][j] >= 100) {
          ck = j;
          break;
        }
      } else
        table[x][j] = max(table[x + 1][j], table[x][j - 1]);
      x++;
      j++;
    }
    if (ck) break;
  }
  if (ck) {
    cal(x, ck);
    ans = vec.size() - 100;
    if (ans % 2 == 0) {
      ans = ans / 2;
      sort(vec.begin(), vec.end());
      for (i = ans; i < vec.size() - ans; i++) cout << str2[vec[i]];
    } else {
      cnt = 0;
      ans = ans - 1;
      ans = ans / 2;
      x = vec.size() / 2;
      sort(vec.begin(), vec.end());
      for (i = ans; i < vec.size() - ans; i++) {
        if (i != x) {
          cout << str2[vec[i]];
        }
      }
    }
  } else {
    cal(1, n);
    sort(vec.begin(), vec.end());
    for (i = 0; i < vec.size(); i++) cout << str2[vec[i]];
  }
}
