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;
int dp[2605][2605] = {}, cnt = 0;
char a[2605];
bool BOOL = 0;
string s;
void recur(int l, int r) {
  if (l == r) {
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
    return;
  }
  if (dp[l][r] == dp[l + 1][r])
    recur(l + 1, r);
  else if (dp[l][r] == dp[l][r - 1])
    recur(l, r - 1);
  else if (dp[l][r] == dp[l + 1][r - 1] + 2) {
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
    recur(l + 1, r - 1);
    if (!(BOOL && cnt == 50)) {
      cout << a[l];
      cnt++;
    } else
      BOOL = 0;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  if (s.length() > 2600) {
    for (char i = 'a'; i <= 'z'; i++) {
      int freq = 0;
      for (int j = 0; j < s.length(); j++) freq += (s[j] == i);
      if (freq >= 100) {
        for (int j = 1; j <= 100; j++) cout << i;
        return 0;
      }
    }
  }
  for (int i = 1; i <= s.length(); i++) {
    a[i] = s[i - 1];
    dp[i][i] = 1;
  }
  for (int i = 2; i <= s.length(); i++) {
    for (int j = 1, k = i; k <= s.length(); j++, k++) {
      dp[j][k] = max(max(dp[j + 1][k], dp[j][k - 1]),
                     (a[j] == a[k]) * (dp[j + 1][k - 1] + 2));
      if (dp[j][k] == 100) {
        recur(j, k);
        return 0;
      } else if (dp[j][k] == 101) {
        BOOL = 1;
        recur(j, k);
        return 0;
      }
    }
  }
  recur(1, s.length());
  return 0;
}