Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible.

Input

The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) containing only lowercase English letters.

Output

If s contains a palindrome of length exactly 100 as a subsequence, print any palindrome of length 100 which is a subsequence of s. If s doesn't contain any palindromes of length exactly 100, print a palindrome that is a subsequence of s and is as long as possible.

If there exists multiple answers, you are allowed to print any of them.

Examples

Input

bbbabcbbb


Output

bbbcbbb


Input

rquwmzexectvnbanemsmdufrg


Output

rumenanemur

Note

A subsequence of a string is a string that can be derived from it by deleting some characters without changing the order of the remaining characters. A palindrome is a string that reads the same forward or backward.
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  register int c = getchar();
  x = 0;
  int neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x << 1) + (x << 3) + c - 48;
  }
  if (neg) x = -x;
}
inline void writeln(int x) {
  char buffor[21];
  register int i = 0;
  int neg = 0;
  if (x < 0) {
    neg = 1;
    x = -x;
  }
  do {
    buffor[i++] = (x % 10) + '0';
    x /= 10;
  } while (x);
  i--;
  if (neg) putchar('-');
  while (i >= 0) putchar(buffor[i--]);
  putchar('\n');
}
const int N = 5e4 + 10;
int n, f[N][101], maxlen, Next[N][201];
int Trace[N][101];
string s;
vector<char> pa;
void input() {
  cin >> s;
  n = s.size();
  s = " " + s;
  maxlen = min(n, 100);
}
void init_Next() {
  for (int i = 'a'; i <= 'z'; i++) {
    for (int j = 1; j <= n; j++) {
      Next[j][i] = Next[j - 1][i];
      if (s[j] == i) Next[j][i] = j;
    }
  }
}
void solve() {
  init_Next();
  for (int i = 0; i <= n - 1; i++) f[i][0] = i + 1;
  for (int i = 1; i <= n; i++) f[i][1] = i;
  for (int i = 0; i <= n - 1; i++)
    for (int len = 0; len <= min(maxlen, i); len++) {
      if (f[i + 1][len] < f[i][len]) {
        f[i + 1][len] = f[i][len];
        Trace[i + 1][len] = len;
      }
      int j = f[i][len] - 1;
      if (j < 1) continue;
      int pos = Next[j][s[i + 1]];
      if (f[i + 1][len + 2] < pos) {
        f[i + 1][len + 2] = pos;
        Trace[i + 1][len + 2] = len;
      }
    }
  int res = 0;
  for (int len = maxlen; len >= 1; len--)
    if (f[n][len] > 0) {
      res = len;
      break;
    }
  int curlen = res;
  for (int i = n; i >= 1; i--) {
    if (Trace[i][curlen] != curlen) pa.push_back(s[i]);
    curlen = Trace[i][curlen];
  }
  for (auto c : pa) cout << c;
  if (res % 2 == 0)
    for (int i = (int)pa.size() - 1; i >= 0; i--) cout << pa[i];
  else
    for (int i = (int)pa.size() - 2; i >= 0; i--) cout << pa[i];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  input();
  solve();
  return 0;
}
