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 long long MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;
priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;
char s[50001];
int al[26];
int dp[2600][2600];
int tra[2600][2600];
int go(int l, int r) {
  if (l > r) return 0;
  if (l == r) return 1;
  if (dp[l][r] != -1) return dp[l][r];
  int mav = 0, t;
  if (s[l] == s[r]) {
    t = go(l + 1, r - 1) + 2;
    if (mav < t) {
      mav = t;
      tra[l][r] = 0;
    }
  }
  t = go(l + 1, r);
  if (mav < t) {
    mav = t;
    tra[l][r] = 1;
  }
  t = go(l, r - 1);
  if (mav < t) {
    mav = t;
    tra[l][r] = 2;
  }
  return dp[l][r] = mav;
}
int main() {
  memset(dp, -1, sizeof(dp));
  scanf("%s", s);
  int n = strlen(s);
  for (int i = 0; i < n; i++) {
    if (++al[s[i] - 'a'] == 100) {
      for (int j = 0; j < 100; j++) printf("%c", s[i]);
      return 0;
    }
  }
  go(0, n - 1);
  int l = 0, r = n - 1, cnt = 0;
  while (l < r && cnt < 100) {
    if (tra[l][r] == 0) {
      printf("%c", s[l]);
      v.push_back(s[r]);
      l++;
      r--;
      cnt += 2;
    } else if (tra[l][r] == 1)
      l++;
    else
      r--;
  }
  if (cnt != 100 && l == r) printf("%c", s[l]);
  for (auto i = v.rbegin(); i != v.rend(); i++) printf("%c", *i);
}