#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;
char s[50001];
int al[26];
int dp[2600][2600];
int tra[2600][2600];
int go(int l, int r) {
  if (l > r) return 0;
  if (l == r) return 1;
  if (dp[l][r] != -1) return dp[l][r];
  int mav = 0, t;
  if (s[l] == s[r]) {
    t = go(l + 1, r - 1) + 2;
    if (mav < t) {
      mav = t;
      tra[l][r] = 0;
    }
  }
  t = go(l + 1, r);
  if (mav < t) {
    mav = t;
    tra[l][r] = 1;
  }
  t = go(l, r - 1);
  if (mav < t) {
    mav = t;
    tra[l][r] = 2;
  }
  return dp[l][r] = mav;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) {
    if (++al[s[i] - 'a'] == 100) {
      for (int j = 0; j < 100; j++) printf("%c", s[i]);
      return 0;
    }
  }
  go(0, n - 1);
  int l = 0, r = n - 1, cnt = 0;
  while (l < r && cnt < 100) {
    if (tra[l][r] == 0) {
      printf("%c", s[l]);
      v.push_back(s[r]);
      l++;
      r--;
      cnt += 2;
    } else if (tra[l][r] == 1)
      l++;
    else
      r--;
  }
  if (cnt != 100 && l == r) printf("%c", s[l]);
  for (auto i = v.rbegin(); i != v.rend(); i++) printf("%c", *i);
}
