#include <bits/stdc++.h>
using namespace std;
using namespace std;
int main() {
  string s;
  cin >> s;
  int pos_r = s.length() - 1;
  int pos_l = 0;
  string mid = "";
  string ans;
  while (pos_r - pos_l >= 3) {
    bool fl = false;
    for (int i = pos_l; i <= pos_l + 1; i++)
      for (int j = pos_r - 1; j <= pos_r; j++) {
        if (s[i] == s[j] && !fl) {
          pos_l = i + 1;
          pos_r = j - 1;
          ans += s[i];
          fl = true;
        }
      }
  }
  if (pos_r >= pos_l) mid = s[pos_r];
  cout << ans << mid;
  reverse(ans.begin(), ans.end());
  cout << ans;
}
