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;
string s;
string str_rez = "";
int n;
set<int> all[26];
map<pair<int, int>, int> f;
map<pair<int, int>, char> best;
inline int next(char c, int start) {
  if (all[c - 'a'].empty()) {
    return -1;
  }
  set<int>::iterator it = all[c - 'a'].lower_bound(start);
  if (it == all[c - 'a'].end()) {
    return -1;
  }
  return *it;
}
inline int prev(char c, int start) {
  if (all[c - 'a'].empty()) {
    return -1;
  }
  set<int>::iterator it = all[c - 'a'].upper_bound(start);
  if (it == all[c - 'a'].begin()) {
    return -1;
  }
  it--;
  return *it;
}
int ff(int start, int end) {
  if (start < 0 || end >= n || start > end) {
    return 0;
  }
  if (start == end) {
    return 1;
  }
  pair<int, int> key = make_pair(start, end);
  map<pair<int, int>, int>::iterator it = f.find(key);
  if (it != f.end()) {
    return it->second;
  }
  int rez = 0;
  char best_char = '_';
  for (char c = 'a'; c <= 'z'; c++) {
    int next_start = next(c, start);
    if (next_start < 0) continue;
    int next_end = prev(c, end);
    if (next_end < 0) continue;
    if (next_start > next_end) continue;
    int tmp =
        ff(next_start + 1, next_end - 1) + (next_start == next_end ? 1 : 2);
    if (tmp > rez) {
      rez = tmp;
      best_char = c;
      if (rez >= 100) {
        break;
      }
    }
  }
  f[key] = rez;
  best[key] = best_char;
  return rez;
}
void print_rez(int start, int end, string& rez, int left) {
  if (start == end) {
    rez.push_back(s[start]);
    return;
  }
  pair<int, int> key = make_pair(start, end);
  map<pair<int, int>, int>::iterator next_it = f.find(key);
  map<pair<int, int>, char>::iterator best_it = best.find(key);
  rez.push_back(best_it->second);
  left--;
  if (left > 0) {
    print_rez(next(best_it->second, start) + 1, prev(best_it->second, end) - 1,
              rez, left);
  }
}
int main() {
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; i++) {
    all[s[i] - 'a'].insert(i);
  }
  int rez = ff(0, n - 1);
  print_rez(0, n - 1, str_rez, rez / 2 + rez % 2);
  if (rez < 100) {
    cout << str_rez;
    if (rez % 2 != 0) {
      str_rez = str_rez.substr(0, str_rez.size() - 1);
    }
    reverse(str_rez.begin(), str_rez.end());
    cout << str_rez << endl;
  } else if (rez == 100) {
    cout << str_rez;
    reverse(str_rez.begin(), str_rez.end());
    cout << str_rez << endl;
  } else {
    if (rez % 2 != 0) {
      str_rez = str_rez.substr(0, str_rez.size() - 1);
      rez--;
    }
    str_rez = str_rez.substr(0, 50);
    cout << str_rez;
    reverse(str_rez.begin(), str_rez.end());
    cout << str_rez << endl;
  }
  return 0;
}
