#include <bits/stdc++.h>
using namespace std;
long long f[2610][2610];
char res[3000];
string s;
long long cnt[30];
int main() {
  cin >> s;
  long long n = s.size(), mx = 0;
  char mxi;
  for (long long i = 0; i < n; i++) {
    ++cnt[s[i] - 'a'];
    if (mx < cnt[s[i] - 'a']) {
      mx = cnt[s[i] - 'a'];
      mxi = s[i];
    }
  }
  if (mx >= 100) {
    for (long long i = 0; i < 100; i++) cout << mxi;
    cout << endl;
    return 0;
  }
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < n + 1; j++) f[i][j] = 0;
  for (int i = 0; i < n; i++) f[i][i] = 1;
  for (int m = 1; m < n; m++)
    for (int i = 0; i < n - m; i++) {
      int j = i + m;
      if (s[i] == s[j]) f[i][j] = f[i + 1][j - 1] + 2;
      if (f[i][j] < f[i + 1][j]) f[i][j] = f[i + 1][j];
      if (f[i][j] < f[i][j - 1]) f[i][j] = f[i][j - 1];
    }
  int i = 0;
  int j = n - 1;
  int len = f[i][j];
  res[len] = '\0';
  int a = 0;
  int b = f[i][j] - 1;
  while (i <= j) {
    if (i == j) {
      res[a] = s[i];
      break;
    }
    if (s[i] == s[j]) {
      res[a] = res[b] = s[i];
      a++, b--, i++, j--;
      continue;
    }
    if (f[i][j] == f[i + 1][j]) {
      i++;
      continue;
    }
    j--;
  }
  if (len > 100) {
    len = 100;
    for (int i = 0; i < 50; i++) res[99 - i] = res[i];
    res[len] = '\0';
  }
  cout << res << endl;
  return 0;
}
