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 inf = 1000000000;
const int MOD = 1000000007;
const double pi = acos(-1.0);
int cnt[1111];
int dp[2606][2606];
int pr[3000][26];
int suf[3000][26];
int nx[2606][2606];
int get(int i1, int i2) {
  if (i1 < 0 || i2 < 0) return 0;
  if (dp[i1][i2] != -1) return dp[i1][i2];
  int t = 1 + (i1 != i2);
  dp[i1][i2] = t;
  if (i1 > 0)
    for (int i = (0); i <= (25); ++i) {
      int cur = t + get(pr[i1 - 1][i], suf[i2 + 1][i]);
      if (cur > dp[i1][i2]) {
        dp[i1][i2] = cur;
        nx[i1][i2] = i;
      }
    }
  return dp[i1][i2];
}
int main() {
  string s;
  cin >> s;
  for (int i = (0); i <= ((int)((s).size()) - 1); ++i) cnt[s[i]]++;
  for (int i = ('a'); i <= ('z'); ++i)
    if (cnt[i] >= 100) {
      for (int j = (1); j <= (100); ++j) cout << char(i);
      cout << endl;
      return 0;
    }
  memset(dp, -1, sizeof(dp));
  memset(pr, -1, sizeof(pr));
  memset(suf, -1, sizeof(suf));
  for (int i = (0); i <= ((int)((s).size()) - 1); ++i) {
    if (i)
      for (int j = (0); j <= (25); ++j) pr[i][j] = pr[i - 1][j];
    pr[i][s[i] - 'a'] = i;
  }
  for (int i = (int)((s).size()) - 1; i >= 0; --i) {
    for (int j = (0); j <= (25); ++j) suf[i][j] = suf[i + 1][j];
    suf[i][s[i] - 'a'] = i;
  }
  for (int i1 = (0); i1 <= ((int)((s).size()) - 1); ++i1)
    for (int i2 = (i1 + 1); i2 <= ((int)((s).size()) - 1); ++i2)
      if (s[i1] == s[i2] && get(i1, i2) >= 100) {
        string ans = "";
        for (int it = (1); it <= (50); ++it) {
          ans += s[i1];
          int I1 = i1, I2 = i2;
          if (I1 == 0) break;
          i1 = pr[I1 - 1][nx[I1][I2]];
          i2 = suf[I2 + 1][nx[I1][I2]];
        }
        for (int it = (1); it <= (2); ++it) {
          reverse(ans.begin(), ans.end());
          cout << ans;
        }
        cout << endl;
        return 0;
      }
  pair<int, int> r = make_pair(0, 0);
  int best = 1;
  for (int i1 = (0); i1 <= ((int)((s).size()) - 1); ++i1)
    for (int i2 = (i1); i2 <= ((int)((s).size()) - 1); ++i2)
      if (s[i1] == s[i2] && get(i1, i2) >= best)
        best = get(i1, i2), r = make_pair(i1, i2);
  string ans = "";
  while (r.first >= 0 && r.second >= 0) {
    string temp = "";
    temp += s[r.first];
    temp += ans;
    if (r.first != r.second) temp += s[r.second];
    ans = temp;
    int I1 = r.first, I2 = r.second;
    if (I1 == 0) break;
    int i1 = pr[I1 - 1][nx[I1][I2]];
    int i2 = suf[I2 + 1][nx[I1][I2]];
    r = make_pair(i1, i2);
  }
  cout << ans << endl;
}