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;
void Draganov47() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
string show(int l, int r, string& s, vector<unordered_map<int, int>>& dp) {
  if (l > r) return "";
  if (l == r) {
    string kek = "";
    kek += s[l];
    return kek;
  }
  if (dp[l][r] == dp[l + 1][r]) return show(l + 1, r, s, dp);
  if (dp[l][r] == dp[l][r - 1]) return show(l, r - 1, s, dp);
  if (dp[l][r] == dp[l + 1][r - 1] + (s[l] == s[r]) * 2)
    return s[l] + show(l + 1, r - 1, s, dp) + s[r];
}
void upd(int l, int r, string& s, vector<unordered_map<int, int>>& dp) {
  if (l > r) return;
  if (dp[l][r] != 0) return;
  upd(l + 1, r - 1, s, dp);
  upd(l + 1, r, s, dp);
  upd(l, r - 1, s, dp);
  dp[l][r] = max(max(dp[l + 1][r], dp[l][r - 1]),
                 dp[l + 1][r - 1] + (s[l] == s[r]) * 2);
  if (dp[l][r] == 100) {
    cout << show(l, r, s, dp);
    exit(0);
  }
  if (dp[l][r] == 101) {
    string ans = show(l, r, s, dp);
    for (int i = 0; i < 50; i++) {
      cout << ans[i];
    }
    for (int j = 51; j < 101; j++) {
      cout << ans[j];
    }
    exit(0);
  }
}
int main() {
  Draganov47();
  string s;
  cin >> s;
  vector<unordered_map<int, int>> dp(s.size());
  for (int i = 0; i < s.size(); i++) dp[i][i] = 1;
  upd(0, s.size() - 1, s, dp);
  cout << show(0, s.size() - 1, s, dp);
  return 0;
}