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 MOD = 1e9 + 7;
const int N = 2705;
template <class T>
inline void chmax(T &x, T y) {
  x = max((x), (y));
}
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
string s, ans1 = "", ans2 = "";
int dp[N][N];
int n;
int f(int x, int y) {
  if (x > y) return 0;
  if (x == y) return 1;
  int &res = dp[x][y];
  if (res ^ -1) return res;
  res = 0;
  if (s[x] == s[y]) {
    chmax(res, f(x + 1, y - 1) + 2);
  } else {
    chmax(res, f(x + 1, y));
    chmax(res, f(x, y - 1));
  }
  return res;
}
void path(int x, int y) {
  if (x > y) return;
  if (static_cast<int32_t>(ans2.size()) + static_cast<int32_t>(ans1.size()) ==
      100)
    return;
  if (x == y) {
    ans1 += s[x];
    return;
  }
  if (s[x] == s[y]) {
    ans1 += s[x];
    ans2 += s[y];
    path(x + 1, y - 1);
  } else {
    if (dp[x + 1][y] > dp[x][y - 1])
      path(x + 1, y);
    else
      path(x, y - 1);
  }
}
int32_t main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> s;
  n = static_cast<int32_t>(s.size());
  if (n >= 2600) {
    map<char, int> cnt;
    for (int i = 0; i < n; ++i) {
      cnt[s[i]]++;
    }
    for (auto &it : cnt) {
      if (it.second >= 100) {
        cout << string(100, it.first);
        return 0;
      }
    }
  } else {
    memset(dp, -1, sizeof(dp));
    f(0, n - 1);
    path(0, n - 1);
    reverse(ans2.begin(), ans2.end());
    cout << ans1 + ans2;
  }
  return 0;
}
