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 maxint = -1u >> 1;
char s[500010];
int n;
int dp[3010][3010];
pair<int, int> pre[3010][3010];
pair<int, int> ans;
int Max;
int dfs(int l, int r) {
  if (dp[l][r] != -1) return dp[l][r];
  if (l == r) return 1;
  if (l > r) return 0;
  int &ret = dp[l][r] = 0;
  if (s[l] == s[r]) {
    pre[l][r] = make_pair(l + 1, r - 1);
    ret = dfs(l + 1, r - 1) + 2;
  } else {
    if (dfs(l + 1, r) > ret) {
      ret = dfs(l + 1, r);
      pre[l][r] = make_pair(l + 1, r);
    }
    if (dfs(l, r - 1) > ret) {
      ret = dfs(l, r - 1);
      pre[l][r] = make_pair(l, r - 1);
    }
  }
  if (Max == 100) return ret;
  if (ret > Max) {
    Max = ret;
    ans = make_pair(l, r);
  }
  return ret;
}
vector<int> vec;
void Output() {
  int l = ans.first, r = ans.second;
  vec.clear();
  while (l <= r) {
    if (l == r) {
      vec.push_back(l);
      break;
    }
    pair<int, int> nxt = pre[l][r];
    if (nxt.first == l + 1 && nxt.second == r - 1) {
      vec.push_back(l);
      vec.push_back(r);
      if ((int)vec.size() == 100) break;
    }
    l = nxt.first, r = nxt.second;
  }
  sort(vec.begin(), vec.end());
  for (int i = 0; i < (int)vec.size(); i++) {
    printf("%c", s[vec[i]]);
  }
  cout << endl;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  n = min(n, 3000);
  memset(dp, -1, sizeof(dp));
  ans = make_pair(1, 1);
  Max = 0;
  dfs(1, n);
  Output();
  return 0;
}