#include <bits/stdc++.h>
using namespace std;
int dp[2605][2605] = {}, cnt = 0;
char a[2605];
bool BOOL = 0;
string s;
void recur(int l, int r) {
  if (l == r) {
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
    return;
  }
  if (dp[l][r] == dp[l + 1][r])
    recur(l + 1, r);
  else if (dp[l][r] == dp[l][r - 1])
    recur(l, r - 1);
  else if (dp[l][r] == dp[l + 1][r - 1] + 2) {
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
    recur(l + 1, r - 1);
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  if (s.length() > 2600) {
    for (char i = 'a'; i <= 'z'; i++) {
      int freq = 0;
      for (int j = 0; j < s.length(); j++) freq += (s[j] == i);
      if (freq >= 100) {
        for (int j = 1; j <= 100; j++) cout << i;
        return 0;
      }
    }
  }
  for (int i = 1; i <= s.length(); i++) {
    a[i] = s[i - 1];
    dp[i][i] = 1;
  }
  for (int i = 2; i <= s.length(); i++) {
    for (int j = 1, k = i; k <= s.length(); j++, k++) {
      dp[j][k] = max(max(dp[j + 1][k], dp[j][k - 1]),
                     (a[j] == a[k]) * (dp[j + 1][k - 1] + 2));
      if (dp[j][k] == 100) {
        recur(j, k);
        return 0;
      } else if (dp[j][k] == 101) {
        BOOL = 1;
        recur(j, k);
        return 0;
      }
    }
  }
  recur(1, s.length());
  return 0;
}
