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 maxN = 5 * 10000 + 10;
vector<int> v[26];
int dp[maxN][110];
char lps[maxN];
bool mark[maxN];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    v[s[i] - 'a'].push_back(i);
  }
  memset(dp, 63, sizeof dp);
  for (int i = 0; i < n; i++) {
    dp[i][1] = i;
    dp[i][0] = i - 1;
  }
  int ans = 1;
  for (int k = 2; k <= min(n, 100); k++) {
    for (int i = n - k + 1; i--;) {
      dp[i][k] = dp[i + 1][k];
      int x = s[i] - 'a';
      if (v[x].back() > dp[i + 1][k - 2]) {
        int dw = -1;
        int up = v[x].size();
        while (up - dw > 1) {
          int md = (dw + up) / 2;
          if (v[x][md] > dp[i + 1][k - 2])
            up = md;
          else
            dw = md;
        }
        dp[i][k] = min(dp[i][k], v[x][up]);
      }
      if (dp[i][k] < 1e9) {
        ans = k;
      }
    }
  }
  int x = ans;
  int t = 0;
  int T = n;
  while (x >= 1) {
    for (int i = T; i--;) {
      if (dp[i][x] < T && s[i] == s[dp[i][x]]) {
        lps[t + 1] = s[i];
        lps[ans - t] = s[dp[i][x]];
        t++;
        T = dp[i][x];
        break;
      }
    }
    x -= 2;
  }
  for (int i = 1; i <= ans; i++) {
    cout << lps[i];
  }
  cout << endl;
  return 0;
}