Problem: 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.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int MX = (1 << 17);
string str;
int n;
void proc(char let, int *nxt, int *Prev) {
  for (int j = 1; j <= n + 1; j++) {
    Prev[j] = Prev[j - 1];
    if (str[j - 1] == let) Prev[j] = j - 1;
  }
  for (int j = n - 1; j >= 0; j--) {
    nxt[j] = nxt[j + 1];
    if (str[j + 1] == let) nxt[j] = j + 1;
  }
}
int nxt[26][MX], Prev[26][MX];
int par[52][MX], dp[52][MX];
int main() {
  cin >> str;
  n = str.size();
  str = "#" + str;
  memset(dp, -1, sizeof(dp));
  memset(Prev, -1, sizeof(Prev));
  memset(nxt, -1, sizeof(nxt));
  for (char j = 'a'; j <= 'z'; j++) proc(j, nxt[j - 'a'], Prev[j - 'a']);
  dp[0][0] = n + 1;
  int ans = 1, L, solpos;
  for (int len = 0; len <= min(50, n); len++) {
    for (int j = 0; j <= n + 1; j++) {
      if (dp[len][j] == -1) continue;
      int tt = len * 2;
      if (dp[len][j] - j > 1 && tt < 100) tt++;
      if (tt > ans) {
        ans = tt;
        L = len;
        solpos = j;
      }
      int left = j, right = dp[len][j];
      for (int let = 0; let < 26; let++) {
        int nleft = nxt[let][left], nright = Prev[let][right];
        if (nleft == -1 || nright == -1 || nleft >= nright) continue;
        if (dp[len + 1][nleft] < nright) {
          dp[len + 1][nleft] = nright;
          par[len + 1][nleft] = left;
        }
      }
    }
  }
  if (ans == 1) {
    cout << str[1] << endl;
    return 0;
  }
  deque<char> Q;
  if (dp[L][solpos] - solpos > 1 && ans % 2) Q.push_back(str[solpos + 1]);
  int pos = solpos;
  while (L > 0) {
    Q.push_back(str[pos]);
    Q.push_front(str[pos]);
    pos = par[L][pos];
    L--;
  }
  for (int j = 0; j < Q.size(); j++) cout << Q[j];
  cout << endl;
}