#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;
      }
    }
  }
}
