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 auto maxn = 50000;
int m[2650][2650];
pair<int, string> v[2650][2650];
string s;
string build_back(int i, int j);
string LPS() {
  memset(m, 0, sizeof(m));
  for (int i = +0, Ly = s.size() + 0, cxt = i < Ly ? 1 : -1; i != Ly;
       i += cxt) {
    m[i][i] = 1;
    v[i][i] = make_pair(-1, s[i]);
  }
  for (int len = 2 + 0, Ly = s.size() + 1 + 0, cxt = len < Ly ? 1 : -1;
       len != Ly; len += cxt) {
    for (int i = 0 + 0, Ly = s.size() - len + 1 + 0, cxt = i < Ly ? 1 : -1;
         i != Ly; i += cxt) {
      int j = i + len - 1;
      if (s[i] == s[j] && len == 2) {
        m[i][j] = 2;
        v[i][j] = make_pair(0, s[i]);
      } else if (s[i] == s[j]) {
        m[i][j] = m[i + 1][j - 1] + 2;
        v[i][j] = make_pair(0, s[i]);
      } else {
        if (m[i][j - 1] >= m[i + 1][j]) {
          m[i][j] = m[i][j - 1];
          v[i][j] = make_pair(1, "");
        } else {
          m[i][j] = m[i + 1][j];
          v[i][j] = make_pair(2, "");
        }
      }
      if (m[i][j] == 100) return build_back(i, j);
      if (m[i][j] == 101) {
        string r = build_back(i, j);
        r.erase(r.begin() + r.size() / 2);
        return r;
      }
    }
  }
  return build_back(0, s.size() - 1);
}
string build_back(int i, int j) {
  if (i > j) return "";
  if (i + 1 == j) return s[i] == s[j] ? s.substr(i, 2) : s.substr(i, 1);
  if (i == j) return v[i][j].second;
  if (v[i][j].first == 0)
    return v[i][j].second + build_back(i + 1, j - 1) + v[i][j].second;
  if (v[i][j].first == 1) return build_back(i, j - 1);
  if (v[i][j].first == 2) return build_back(i + 1, j);
}
int main() {
  cin >> s;
  if (s.size() <= 2600) {
    cout << LPS() << endl;
  } else {
    int l[26];
    memset(l, 0, sizeof(l));
    for (int i = +0, Ly = s.size() + 0, cxt = i < Ly ? 1 : -1; i != Ly;
         i += cxt) {
      l[s[i] - 'a']++;
      if (l[s[i] - 'a'] == 100) {
        cout << string(100, s[i]) << endl;
        break;
      }
    }
  }
}