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;
template <class T>
void PV(T a, T b) {
  while (a != b) cout << *a++ << " ";
  cout << endl;
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
string s;
int n;
int Next[50010][26];
int d[50010][110];
int R[50010][110];
int t[50010][110];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  n = s.length();
  if (n == 1) {
    cout << s << endl;
    return 0;
  }
  if (n == 2) {
    if (s[0] == s[1])
      cout << s << endl;
    else
      cout << s[0] << endl;
    return 0;
  }
  for (int i = 0; i < 26; i++) {
    int pr = -1;
    for (int j = 0; j < n; j++) {
      Next[j][i] = pr;
      if (s[j] == i + 'a') pr = j;
    }
  }
  memset(R, -1, sizeof(R));
  ;
  for (int i = 0; i < n; i++) {
    d[i][1] = 1, R[i][1] = i, t[i][1] = 1;
  }
  for (int i = 1; i < n; i++) {
    for (int j = 2; j <= 100; j++) {
      d[i][j] = d[i - 1][j];
      R[i][j] = R[i - 1][j];
      if (j == 2) {
        int nt = Next[i][s[i] - 'a'];
        if (nt != -1) {
          if (chmax(R[i][j], nt)) {
            d[i][j] = 1;
            t[i][j] = 1;
          }
        }
      }
      if (j == 2 || !d[i - 1][j - 2]) continue;
      int nt = Next[R[i - 1][j - 2]][s[i] - 'a'];
      if (nt == -1) continue;
      if (chmax(R[i][j], nt)) {
        d[i][j] = 1;
        t[i][j] = 1;
      }
    }
  }
  for (int i = 100; i >= 1; i--)
    for (int j = 0; j < n; j++) {
      if (d[j][i]) {
        int len = i;
        int cnt = i;
        string res;
        while (cnt > 0) {
          if (t[j][i]) {
            res += s[j];
            i -= 2;
            cnt -= 2;
          }
          j--;
        }
        string rev = res;
        reverse((rev).begin(), (rev).end());
        if (len % 2) rev = rev.substr(1);
        res += rev;
        assert(res.length() == len);
        cout << res << endl;
        return 0;
      }
    }
  return 0;
}
