#include <bits/stdc++.h>
using namespace std;
char s[110000];
int f[3100][3100];
int g[3100][3100];
int las[3100][31];
char ans[31000];
int tot = 0;
void calc(int x, int y) {
  if (f[x][y] == 0) return;
  if (g[x][y] == 3) {
    if (x != y) ans[++tot] = s[x];
    calc(x - 1, y + 1);
    ans[++tot] = s[y];
  }
  if (g[x][y] == 2) {
    calc(x, y + 1);
  }
  if (g[x][y] == 1) {
    calc(x - 1, y);
  }
}
int sum[110];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  memset(las, 0, sizeof(las));
  if (n >= 2600) {
    for (int i = 1; i <= n; i++) sum[s[i] - 'a']++;
    for (int i = 0; i < 26; i++) {
      if (sum[i] >= 100) {
        for (int k = 1; k <= 100; k++) printf("%c", i + 'a');
        printf("\n");
        break;
      }
    }
  } else {
    memset(f, 0, sizeof(f));
    for (int i = 1; i <= n; i++)
      for (int j = n; j >= i; j--) {
        if (f[i - 1][j] > f[i][j]) {
          f[i][j] = f[i - 1][j];
          g[i][j] = 1;
        }
        if (f[i][j + 1] > f[i][j]) {
          f[i][j] = f[i][j + 1];
          g[i][j] = 2;
        }
        if (i != j && s[i] == s[j] && f[i - 1][j + 1] + 1 > f[i][j]) {
          f[i][j] = f[i - 1][j + 1] + 2;
          g[i][j] = 3;
        }
        if (i == j && s[i] == s[j] && f[i - 1][j + 1] + 1 > f[i][j]) {
          f[i][j] = f[i - 1][j + 1] + 1;
          g[i][j] = 3;
        }
      }
    int len = -1;
    int x, y;
    for (int i = 1; i <= n; i++)
      for (int j = i; j <= n; j++) {
        if (f[i][j] <= 100 && f[i][j] > len) {
          len = f[i][j];
          x = i, y = j;
        }
      }
    calc(x, y);
    len = tot / 2;
    for (int i = len; i >= 1; i--) printf("%c", ans[i]);
    if (tot % 2 == 1) printf("%c", ans[tot]);
    for (int i = 1; i <= len; i++) printf("%c", ans[i]);
    printf("\n");
  }
}
