#include <bits/stdc++.h>
using namespace std;
char s[50050], ans[2650];
int num[30];
int f[2650][2650];
int n, len;
int search(int l, int r) {
  if (r < l) return 0;
  if (f[l][r]) return f[l][r];
  if (l == r) return f[l][r] = 1;
  if (s[l] == s[r]) return f[l][r] = search(l + 1, r - 1) + 2;
  return f[l][r] = max(search(l + 1, r), search(l, r - 1));
}
void back(int l, int r) {
  if (l > r) return;
  if (l == r)
    ans[len++] = s[l];
  else if (s[l] == s[r]) {
    ans[len++] = s[l];
    back(l + 1, r - 1);
    ans[len++] = s[r];
  } else {
    if (f[l + 1][r] > f[l][r - 1])
      back(l + 1, r);
    else
      back(l, r - 1);
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  if (n >= 2600) {
    for (int i = 0; i < n; i++) num[s[i] - 'a']++;
    for (int i = 0; i < 26; i++)
      if (num[i] >= 100) {
        for (int j = 0; j < 100; j++) printf("%c", i + 'a');
        printf("\n");
        break;
      }
  } else {
    search(0, n - 1);
    len = 0;
    back(0, n - 1);
    ans[len] = '\0';
    if (len <= 100)
      printf("%s\n", ans);
    else {
      for (int i = 0; i < 50; i++) printf("%c", ans[i]);
      for (int i = len - 50; i < len; i++) printf("%c", ans[i]);
      printf("\n");
    }
  }
  return 0;
}
