#include <bits/stdc++.h>
using namespace std;
const int maxn = 50010;
int you[maxn][26];
int dp[101][maxn];
char s[110000];
void dfs(int l, int r, int k) {
  if (k == 1) {
    printf("%c", s[l]);
    return;
  }
  if (k == 2) {
    printf("%c%c", s[l], s[r]);
    return;
  }
  printf("%c", s[l]);
  int i;
  for (i = l + 1; dp[k - 2][i] >= r; i++)
    ;
  dfs(i, dp[k - 2][i], k - 2);
  printf("%c", s[r]);
}
int main() {
  int n, i, j, k;
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < 26; i++) you[n][i] = n;
  for (i = n - 1; i >= 0; i--) {
    memcpy(you[i], you[i + 1], sizeof(you[i]));
    you[i][s[i] - 'a'] = i;
  }
  int M = 1;
  for (i = 0; i < n; i++) {
    dp[1][i] = i;
    dp[2][i] = you[i + 1][s[i] - 'a'];
    if (dp[2][i] < n) M = 2;
  }
  for (i = 3; i <= 100; i++) {
    int now = n;
    for (j = n - 1; j >= 0; j--) {
      if (now < n - 1 && you[now + 1][s[j] - 'a'] < n)
        M = i, dp[i][j] = you[now + 1][s[j] - 'a'];
      else
        dp[i][j] = n;
      now = min(dp[i - 2][j], now);
    }
  }
  for (i = 0; dp[M][i] >= n; i++)
    ;
  dfs(i, dp[M][i], M);
  puts("");
}
