#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int memo[2010][2010];
int child[2010][2010];
char str[3000];

int calc(int left, int right) {
  if (memo[left][right] != -1) { return memo[left][right]; }
  if (left >= right) { return 0; }
  if (left == right - 1) { return 1; }
  int ret = 0;
  if (str[left] == str[right - 1]) {
    child[left][right] = 0;
    ret = calc(left + 1, right - 1) + 2;
  } else {
    int lret = calc(left + 1, right);
    int rret = calc(left, right - 1);
    if (lret >= rret) {
      child[left][right] = 1;
    } else {
      child[left][right] = 2;
    }
    ret = max(lret, rret);
  }
  return memo[left][right] = ret;
}

string MakeString(int left, int right) {
  if (left >= right) { return ""; }
  string ret = "";
  if (left == right - 1) { ret = str[left]; }
  else if (child[left][right] == 0) {
    ret = str[left] + MakeString(left + 1, right - 1) + str[right - 1];
  } else if (child[left][right] == 1) {
    ret = MakeString(left + 1, right);
  } else {
    ret = MakeString(left, right - 1);
  }
  return ret;
}

int main() {
  while (scanf("%s", str) > 0) {
    MEMSET(memo, -1);
    MEMSET(child, -1);
    calc(0, strlen(str));
    cout << MakeString(0, strlen(str)) << endl;
  }
}