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;
string s;
vector<char> ans;
int j, n, i, k, fr[30];
int dp[2605][2605];
void recon(int st, int dr) {
  if (s[st] == s[dr]) {
    ans.push_back(s[st]);
    if (st < dr - 1) recon(st + 1, dr - 1);
  } else {
    if (dp[st + 1][dr] > dp[st][dr - 1])
      recon(st + 1, dr);
    else
      recon(st, dr - 1);
  }
}
int main() {
  cin >> s;
  n = s.size();
  if (n <= 2600) {
    for (i = 0; i < n; i++) dp[i][i] = 1;
    for (i = 0; i < n - 1; i++) {
      if (s[i] == s[i + 1])
        dp[i][i + 1] = 2;
      else
        dp[i][i + 1] = 1;
    }
    for (k = 2; k < n; k++) {
      for (i = 0; i + k < n; i++) {
        if (s[i] == s[i + k])
          dp[i][i + k] = dp[i + 1][i + k - 1] + 2;
        else
          dp[i][i + k] = max(dp[i + 1][i + k], dp[i][i + k - 1]);
      }
    }
    recon(0, n - 1);
    if (dp[0][n - 1] >= 100) {
      for (i = 0; i < 50; i++) cout << ans[i];
      for (i = 49; i >= 0; i--) cout << ans[i];
    } else {
      if (dp[0][n - 1] % 2 == 1) {
        for (i = 0; i < ans.size(); i++) cout << ans[i];
        for (i = ans.size() - 2; i >= 0; i--) cout << ans[i];
      } else {
        for (i = 0; i < ans.size(); i++) cout << ans[i];
        for (i = ans.size() - 1; i >= 0; i--) cout << ans[i];
      }
    }
  } else {
    for (i = 0; i < n; i++) fr[s[i] - 'a']++;
    for (i = 0; i < 26; i++)
      if (fr[i] >= 100) {
        for (j = 1; j <= 100; j++) cout << (char)(i + 'a');
        break;
      }
  }
  return 0;
}