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 MN = 2600;
string s;
int dp[MN + 10][MN + 10];
int tf(int i, int j) {
  if (j < i) return 0;
  if (j == i) return dp[i][j] = 1;
  if (dp[i][j] != -1) return dp[i][j];
  if (s[i] == s[j]) return dp[i][j] = tf(i + 1, j - 1) + 2;
  return dp[i][j] = max(tf(i + 1, j), tf(i, j - 1));
}
string ans;
void reconstruct(int i, int j) {
  if (j < i) return;
  if (i == j) {
    ans.push_back(s[i]);
  } else if (s[i] == s[j]) {
    ans.push_back(s[i]);
    reconstruct(i + 1, j - 1);
    ans.push_back(s[j]);
  } else {
    if (dp[i + 1][j] > dp[i][j - 1])
      reconstruct(i + 1, j);
    else
      reconstruct(i, j - 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> s;
  if (s.size() >= MN) {
    int freq[30];
    for (auto &c : s) freq[c - 'a']++;
    for (char c = 'a'; c <= 'z'; c++) {
      if (freq[c - 'a'] >= 100) {
        cout << string(100, c) << endl;
        break;
      }
    }
  } else {
    memset(dp, -1, sizeof dp);
    int n = tf(0, s.size() - 1);
    ans.clear();
    reconstruct(0, s.size() - 1);
    if (n <= 100) {
      cout << ans << endl;
    } else {
      for (int i = 0; i < 50; i++) cout << ans[i];
      for (int i = n - 50; i < n; i++) cout << ans[i];
      cout << endl;
    }
  }
  return 0;
}