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 N = 5e4 + 1000;
int cnt[27], dp[3030][3030], sz;
char ans[N], s[N];
int Rec(int l, int r) {
  if (l > r) return 0;
  if (l == r) return dp[l][r] = 1;
  int &res = dp[l][r];
  if (res != -1) return res;
  res = 0;
  if (s[l] == s[r]) res = max(res, Rec(l + 1, r - 1) + 2);
  res = max(res, max(Rec(l + 1, r), Rec(l, r - 1)));
  return res;
}
void Calc(int l, int r) {
  if (l > r) return;
  if (l == r) {
    ans[sz++] = s[l];
    return;
  }
  if (s[l] == s[r]) {
    ans[sz++] = s[l];
    Calc(l + 1, r - 1);
    ans[sz++] = s[r];
    return;
  }
  if (dp[l + 1][r] > dp[l][r - 1])
    Calc(l + 1, r);
  else
    Calc(l, r - 1);
}
int main() {
  scanf("%s", s);
  int n = strlen(s);
  if (n >= 2600) {
    for (int i = 0; i < n; i++) cnt[s[i] - 'a']++;
    for (int i = 0; i < 26; i++)
      if (cnt[i] >= 100) {
        for (int j = 0; j < 100; j++) putchar(i + 'a');
        return 0;
      }
  }
  memset(dp, -1, sizeof dp);
  Rec(0, n - 1);
  sz = 0;
  Calc(0, n - 1);
  if (sz <= 100)
    printf("%s", ans);
  else {
    for (int i = 0; i < 50; i++) putchar(ans[i]);
    for (int i = 0; i < 50; i++) putchar(ans[sz - 50 + i]);
  }
  return 0;
}