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 = 5000;
string s;
string ans = "";
int n;
int let[500];
int dp[MAXN][MAXN];
bool used[MAXN][MAXN];
int calc(int l, int r) {
  if (l > r) return 0;
  if (l == r) {
    dp[l][r] = 1;
    used[l][r] = true;
    return 1;
  }
  if (used[l][r]) return dp[l][r];
  used[l][r] = true;
  if (s[l - 1] == s[r - 1]) dp[l][r] = 2 + calc(l + 1, r - 1);
  dp[l][r] = max(calc(l + 1, r), dp[l][r]);
  dp[l][r] = max(calc(l, r - 1), dp[l][r]);
  return dp[l][r];
}
void print(int l, int r) {
  if (l > r) return;
  if (l == r) {
    ans.append(1, s[l - 1]);
    return;
  }
  int cur = calc(l, r);
  if (s[l - 1] == s[r - 1] && calc(l + 1, r - 1) + 2 == cur) {
    ans.append(1, s[l - 1]);
    print(l + 1, r - 1);
    ans.append(1, s[l - 1]);
  } else if (calc(l + 1, r) == cur)
    print(l + 1, r);
  else
    print(l, r - 1);
}
int main() {
  getline(cin, s);
  n = (int)s.length();
  for (int i = 0; i < n; i++) let[s[i]]++;
  for (char c = 'a'; c <= 'z'; c++) {
    if (let[c] >= 100) {
      for (int i = 0; i < 100; i++) printf("%c", c);
      return 0;
    }
  }
  calc(1, n);
  print(1, n);
  if ((int)ans.length() <= 100)
    cout << ans;
  else {
    for (int i = 0; i < 50; i++) printf("%c", ans[i]);
    for (int i = 49; i >= 0; i--) printf("%c", ans[i]);
  }
  return 0;
}