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 int N = 100000 + 10;
const int M = 1000000007;
const double PI = atan(1) * 4;
const int oo = 1000000000;
char s[N];
int n, dp[2600][2600], fr[26];
string ans1, ans2;
int calc(int l, int r) {
  if (l > r) return 0;
  int &ret = dp[l][r];
  if (ret != -1) return ret;
  if (l == r) return ret = 1;
  ret = max(calc(l + 1, r), calc(l, r - 1));
  if (s[l] == s[r]) ret = max(ret, 2 + calc(l + 1, r - 1));
  return ret;
}
void solve(int l, int r) {
  if (ans1.size() + ans2.size() == 100) return;
  if (l > r) return;
  int &ret = dp[l][r];
  if (l == r) {
    ans1 += s[l];
    return;
  }
  if (ret == calc(l + 1, r)) {
    solve(l + 1, r);
    return;
  }
  if (ret == calc(l, r - 1)) {
    solve(l, r - 1);
    return;
  }
  ans1 += s[l];
  ans2 += s[r];
  solve(l + 1, r - 1);
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  if (n < 2600) {
    memset(dp, -1, sizeof(dp));
    calc(0, n - 1);
    solve(0, n - 1);
    reverse((ans2).begin(), (ans2).end());
    cout << ans1 << ans2 << endl;
  } else {
    for (int i = 0; i < n; ++i) ++fr[s[i] - 'a'];
    for (int i = 0; i < 26; ++i)
      if (fr[i] > 99) {
        for (int j = 0; j < 100; ++j) printf("%c", i + 'a');
        puts("");
        return 0;
      }
  }
}
