#include <bits/stdc++.h>
using namespace std;
int dp[2610][2610];
int us[2610][2610];
string s;
int len;
int d_p(int i, int j) {
  if (us[i][j]) return dp[i][j];
  us[i][j] = 1;
  if (i > j) return 0;
  if (i == j) return dp[i][j] = 1;
  return dp[i][j] = max(d_p(i + 1, j - 1) + 2 * (s[i] == s[j]),
                        max(d_p(i + 1, j), d_p(i, j - 1)));
}
string ans(int i, int j) {
  char res[2700];
  res[len] = '\0';
  int a = 0;
  int b = len - 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 (dp[i][j] == dp[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';
  }
  string an = res;
  return an;
}
int main() {
  cin >> s;
  if (s.size() >= 2600) {
    vector<int> a(100, 0);
    for (int i = 0; i < s.size(); i++) a[s[i] - 'a']++;
    for (int i = 0; i < 100; i++)
      if (a[i] >= 100) {
        for (int j = 0; j < 100; j++) cout << char(i + 'a');
        cout << endl;
        return 0;
      }
  } else {
    len = d_p(0, s.size() - 1);
    cout << ans(0, s.size() - 1) << endl;
  }
  return 0;
}
