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 = 1e6;
int a[30], n;
char s[5 * N];
int dp[2605][2605];
char res[2605];
int t = 0;
int race(int l, int r) {
  if (l > r) return 0;
  if (dp[l][r]) return dp[l][r];
  if (l == r) return dp[l][r] = 1;
  if (s[l] == s[r]) return dp[l][r] = race(l + 1, r - 1) + 2;
  return dp[l][r] = max(race(l + 1, r), race(l, r - 1));
}
void trace(int x, int y) {
  if (x > y) return;
  if (x == y)
    res[t++] = s[x];
  else if (s[x] == s[y]) {
    res[t++] = s[x];
    trace(x + 1, y - 1);
    res[t++] = s[y];
  } else {
    if (dp[x + 1][y] < dp[x][y - 1])
      trace(x, y - 1);
    else
      trace(x + 1, y);
  }
}
int main() {
  scanf("%s", &s);
  n = strlen(s);
  if (n >= 2600) {
    for (int(i) = int(0); i < int(n); i++) a[s[i] - 'a']++;
    for (int(i) = int(0); i < int(26); i++) {
      if (a[i] >= 100) {
        for (int(j) = int(0); j < int(100); j++) printf("%c", i + 'a');
        return 0;
      }
    }
  } else {
    race(0, n - 1);
    t = 0;
    trace(0, n - 1);
    if (t <= 100)
      for (int(i) = int(0); i < int(t); i++) printf("%c", res[i]);
    else {
      for (int(i) = int(0); i < int(50); i++) printf("%c", res[i]);
      for (int(i) = int(t - 50); i < int(t); i++) printf("%c", res[i]);
    }
  }
}