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>
long long mpow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long b = a;
  while (n) {
    if (n & 1) ret = (ret * b) % mod;
    b = (b * b) % mod;
    n >>= 1;
  }
  return (long long)ret;
}
using namespace std;
int dp[(int)(2600 + 25)][(int)(2600 + 25)];
string ans, s;
void trace(int i, int j) {
  if (j == 1) {
    ans += s[i];
    return;
  }
  if (j == 2) {
    if (dp[i][j] == 1)
      ans += s[i];
    else {
      ans += s[i];
      ans += s[i];
    }
    return;
  }
  if (j >= 3 && (s[i] == s[i + j - 1]) && dp[i][j] == 2 + dp[i + 1][j - 2]) {
    ans += s[i];
    trace(i + 1, j - 2);
    ans += s[i];
  } else if (dp[i][j] == dp[i + 1][j - 1]) {
    trace(i + 1, j - 1);
  } else {
    trace(i, j - 1);
  }
}
void solve() {
  cin >> s;
  int n = s.size();
  s = '#' + s;
  if (n < 2600) {
    for (int i = 1; i <= n; i++) {
      dp[i][1] = 1;
      if (i == n) continue;
      if (s[i] == s[i + 1]) {
        dp[i][2] = 2;
      } else {
        dp[i][2] = 1;
      }
    }
    for (int j = 3; j <= n; j++) {
      for (int i = 1; i + j - 1 <= n; i++) {
        int l = i, r = i + j - 1;
        dp[i][j] = max(dp[i + 1][j - 1], dp[i][j - 1]);
        if (s[l] == s[r]) {
          dp[i][j] = max(dp[i + 1][j - 2] + 2, dp[i][j]);
        }
      }
    }
    for (int j = 1; j <= n; j++) {
      for (int i = 1; i + j - 1 <= n; i++) {
        if (dp[i][j] == 100) {
          trace(i, j);
          cout << ans;
          return;
        }
      }
    }
    trace(1, n);
    string a1, a2;
    if (ans.size() >= 100) {
      for (int i = 0; i < min(50, (int)ans.size()); i++) {
        a1 += ans[i];
        a2 += ans[ans.size() - 1 - i];
      }
      reverse(a2.begin(), a2.end());
      cout << a1 + a2;
      return;
    }
    cout << ans;
    return;
  }
  int c[26];
  memset(c, 0, sizeof(c));
  for (int i = 1; i <= n; i++) {
    c[s[i] - 'a']++;
    if (c[s[i] - 'a'] == 100) {
      for (int j = 0; j < 100; j++) {
        cout << s[i];
      }
      break;
    }
  }
}
int main() {
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
