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.
#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e9;
const int maxn = 3e3 + 10;
const int maxq = 1e3 + 10;
const int alf = 26;
const int dlm = 1e9 + 7;
const long long mod = 998244353;
string O[] = {"YES", "NO", "Yes", "No"};
int lane = 2575;
int r[333];
int dp[maxn][maxn];
int mark[maxn];
string s;
void dfs(int l, int r, string& ans) {
  if (ans.size() == 50) return;
  if (l == r) {
    ans += s[l - 1];
    return;
  }
  if (l > r) return;
  if (s[l - 1] == s[r - 1] && dp[l][r] == dp[l + 1][r - 1] + 2) {
    ans += s[l - 1];
    dfs(l + 1, r - 1, ans);
    ans += s[r - 1];
    return;
  }
  if (dp[l][r - 1] == dp[l][r]) {
    dfs(l, r - 1, ans);
    return;
  }
  if (dp[l + 1][r] == dp[l][r]) {
    dfs(l + 1, r, ans);
    return;
  }
  if (dp[l + 1][r - 1] == dp[l][r]) {
    dfs(l + 1, r - 1, ans);
    return;
  }
}
int main() {
  cin >> s;
  int n = s.size();
  for (int i = 0; i < s.size(); i++) {
    char v = s[i];
    r[v]++;
  }
  char q = '|';
  for (char i = 'a'; i <= 'z'; i++) {
    if (r[i] >= 100) {
      q = i;
      break;
    }
  }
  if (q >= 'a' && q <= 'z') {
    for (int i = 1; i <= 100; i++) {
      cout << q;
    }
    return 0;
  }
  for (int len = 0; len < n; len++) {
    for (int l = 1; (l + len) <= n; l++) {
      int r = len + l;
      if (len == 0) {
        dp[l][l] = 1;
        continue;
      }
      if (s[l - 1] == s[r - 1]) {
        dp[l][r] = dp[l + 1][r - 1] + 2;
      } else {
        dp[l][r] = max(dp[l + 1][r], dp[l][r - 1]);
      }
    }
  }
  string ans = "";
  dfs(1, n, ans);
  cout << ans;
}
