#include <bits/stdc++.h>
using namespace std;
bool IsPalin(const string& T) {
  int L = T.size();
  for (int i = 0; i < L; i++)
    if (T[i] != T[L - 1 - i]) return false;
  return true;
}
string SolveBrute(const string& S) {
  int L = S.size();
  for (int mask = 0; mask < (1 << L); mask++) {
    if (__builtin_popcount(mask) < L / 2) continue;
    string T = "";
    for (int i = 0; i < S.size(); i++) {
      if ((mask >> i) & 1) {
        T.push_back(S[i]);
      }
    }
    if (IsPalin(T)) {
      return T;
    }
  }
  exit(-1);
  return "none";
}
int last_c[1111111][3];
int first_c[1111111][3];
int main() {
  string S;
  cin >> S;
  int n = S.size();
  last_c[0][0] = last_c[0][1] = last_c[0][2] = -1;
  for (int i = 1; i <= n; i++) {
    for (int c = 0; c < 3; c++) {
      if (S[i - 1] == c + 'a') {
        last_c[i][c] = i;
      } else {
        last_c[i][c] = last_c[i - 1][c];
      }
    }
  }
  first_c[n + 1][0] = first_c[n + 1][1] = first_c[n + 1][2] = -1;
  for (int i = n; i >= 1; i--) {
    for (int c = 0; c < 3; c++) {
      if (S[i - 1] == c + 'a') {
        first_c[i][c] = i;
      } else {
        first_c[i][c] = first_c[i + 1][c];
      }
    }
  }
  int st = 1;
  int en = n;
  string ans = "";
  string ans_rev = "";
  while (ans.size() + ans_rev.size() < n / 2) {
    int maxlen = 0;
    int copt = -1;
    int n_st_opt = -1;
    int n_en_opt = -1;
    for (int c = 0; c < 3; c++) {
      int n_st = first_c[st][c];
      int n_en = last_c[en][c];
      if (n_st != -1 && n_en != -1 && n_en - n_st + 1 > maxlen) {
        maxlen = n_en - n_st + 1;
        copt = c;
        n_st_opt = n_st;
        n_en_opt = n_en;
      }
    }
    ans.push_back(copt + 'a');
    if (n_st_opt != n_en_opt) ans_rev.push_back(copt + 'a');
    if (S[n_st_opt - 1] != copt + 'a') exit(-1);
    if (S[n_en_opt - 1] != copt + 'a') exit(-1);
    st = n_st_opt + 1;
    en = n_en_opt - 1;
  }
  std::reverse(ans_rev.begin(), ans_rev.end());
  cout << ans + ans_rev << endl;
  return 0;
  while (0) {
    string S;
    cin >> S;
    cout << S << endl;
    cout << SolveBrute(S) << endl;
    cout << endl;
  }
  while (1) {
    int L = 10;
    string S;
    for (int i = 0; i < L; i++) {
      char c;
      while (1) {
        c = rand() % 3 + 'a';
        if (i > 0 && S.back() == c) continue;
        break;
      }
      S.push_back(c);
    }
    cout << S << endl;
    cout << SolveBrute(S) << endl;
    cout << endl;
  }
}
