#include <bits/stdc++.h>
using namespace std;
char mas[50000];
int d[3000][3000];
int c[3000][3000][2];
int n;
int f;
char ans[128];
void prnt(int x, int y) {
  int t;
  int cnt = 0;
  stack<char> s;
  while (x <= y) {
    if (d[x][y] == 1) {
      if (!f) ans[cnt++] = mas[c[x][y][0]];
    } else {
      ans[cnt++] = mas[c[x][y][0]];
      s.push(mas[c[x][y][1]]);
    }
    t = c[x][y][0] + 1;
    y = c[x][y][1] - 1;
    x = t;
  }
  while (!s.empty()) {
    ans[cnt++] = s.top();
    s.pop();
  }
  printf("%s\n", ans);
}
int main() {
  scanf("%s", mas);
  n = strlen(mas);
  for (int i = 0; i < min(n, 3000); i++) {
    d[i][i] = 1;
    c[i][i][0] = c[i][i][1] = i;
    for (int j = i - 1; j >= 0; j--) {
      if (d[j + 1][i] >= d[j][i - 1]) {
        d[j][i] = d[j + 1][i];
        c[j][i][0] = c[j + 1][i][0];
        c[j][i][1] = c[j + 1][i][1];
      } else {
        d[j][i] = d[j][i - 1];
        c[j][i][0] = c[j][i - 1][0];
        c[j][i][1] = c[j][i - 1][1];
      }
      if (mas[j] == mas[i]) {
        if (d[j][i] < d[j + 1][i - 1] + 2) {
          d[j][i] = d[j + 1][i - 1] + 2;
          c[j][i][0] = j;
          c[j][i][1] = i;
        }
      }
      if (d[j][i] >= 100) {
        f = 1;
        prnt(j, i);
        return 0;
      }
    }
  }
  prnt(0, n - 1);
  return 0;
}
