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;
char s[50050], ans[2650];
int num[30];
int f[2650][2650];
int n, len;
int search(int l, int r) {
  if (r < l) return 0;
  if (f[l][r]) return f[l][r];
  if (l == r) return f[l][r] = 1;
  if (s[l] == s[r]) return f[l][r] = search(l + 1, r - 1) + 2;
  return f[l][r] = max(search(l + 1, r), search(l, r - 1));
}
void back(int l, int r) {
  if (l > r) return;
  if (l == r)
    ans[len++] = s[l];
  else if (s[l] == s[r]) {
    ans[len++] = s[l];
    back(l + 1, r - 1);
    ans[len++] = s[r];
  } else {
    if (f[l + 1][r] > f[l][r - 1])
      back(l + 1, r);
    else
      back(l, r - 1);
  }
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  if (n >= 2600) {
    for (int i = 0; i < n; i++) num[s[i] - 'a']++;
    for (int i = 0; i < 26; i++)
      if (num[i] >= 100) {
        for (int j = 0; j < 100; j++) printf("%c", i + 'a');
        printf("\n");
        break;
      }
  } else {
    search(0, n - 1);
    len = 0;
    back(0, n - 1);
    ans[len] = '\0';
    if (len <= 100)
      printf("%s\n", ans);
    else {
      for (int i = 0; i < 50; i++) printf("%c", ans[i]);
      for (int i = len - 50; i < len; i++) printf("%c", ans[i]);
      printf("\n");
    }
  }
  return 0;
}