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 MAX_N = 2600;
const int ALPH = 26;
void solve() {
  string s, answer;
  cin >> s;
  int sz = s.size();
  if (sz >= MAX_N) {
    int freq[ALPH];
    memset(freq, 0, sizeof(freq));
    for (int i = 0; i < sz; i++) {
      int c = s[i] - 'a';
      freq[c]++;
    }
    for (int i = 0; i < ALPH; i++) {
      if (freq[i] >= 100) {
        answer = "";
        for (int j = 0; j < 100; j++) answer += char('a' + i);
      }
      break;
    }
  } else {
    int dp[sz][sz];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < sz; i++) dp[i][i] = 1;
    for (int l = 2; l <= sz; l++) {
      for (int i = 0; i + l - 1 < sz; i++) {
        int j = i + l - 1;
        if (s[i] == s[j])
          dp[i][j] = dp[i + 1][j - 1] + 2;
        else
          dp[i][j] = max(dp[i][j - 1], dp[i + 1][j]);
      }
    }
    int left = 0;
    int right = sz - 1;
    while (dp[left][right] > 1) {
      if (2 * answer.size() == 100) break;
      if (s[left] == s[right]) {
        answer += s[left];
        left++;
        right--;
      } else {
        if (dp[left + 1][right] > dp[left][right - 1])
          left++;
        else
          right--;
      }
    }
    string r = answer;
    reverse(r.begin(), r.end());
    if (2 * answer.size() < 100 and left <= right and dp[left][right] == 1) {
      answer = answer + s[right] + r;
    } else {
      answer = answer + r;
    }
  }
  cout << answer << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}