#include <bits/stdc++.h>
using namespace std;
const int N = 1000000;
int pr[3][N];
int sf[3][N];
int main() {
  string s;
  cin >> s;
  int n = s.size();
  pr[0][0] = -1;
  pr[1][0] = -1;
  pr[2][0] = -1;
  for (int i = 0; i < n; i++) {
    pr[s[i] - 'a'][i] = i;
    if (s[i] == 'a') {
      pr[1][i] = pr[1][max(i - 1, 0)];
      pr[2][i] = pr[2][max(i - 1, 0)];
    } else if (s[i] == 'b') {
      pr[0][i] = pr[0][max(i - 1, 0)];
      pr[2][i] = pr[2][max(i - 1, 0)];
    } else {
      pr[0][i] = pr[0][max(i - 1, 0)];
      pr[1][i] = pr[1][max(i - 1, 0)];
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    sf[s[i] - 'a'][i] = i;
    if (s[i] == 'a') {
      sf[1][i] = sf[1][min(i + 1, n - 1)];
      sf[2][i] = sf[2][min(i + 1, n - 1)];
    } else if (s[i] == 'b') {
      sf[0][i] = sf[0][min(i + 1, n - 1)];
      sf[2][i] = sf[2][min(i + 1, n - 1)];
    } else {
      sf[0][i] = sf[0][min(i + 1, n - 1)];
      sf[1][i] = sf[1][min(i + 1, n - 1)];
    }
  }
  int l = 0, r = n - 1;
  bool q = false;
  char g;
  string t;
  while (l <= r) {
    if (r - l < 3) {
      set<char> e;
      for (int i = l; i <= r; i++) e.insert(s[i]);
      if (e.size() == (r - l + 1)) {
        q = true;
        g = s[l];
        break;
      }
    }
    int h1, h2, h3;
    h1 = pr[0][r] - sf[0][l];
    h2 = pr[1][r] - sf[1][l];
    h3 = pr[2][r] - sf[2][l];
    if (h1 >= h2 && h1 >= h3) {
      t += 'a';
      l = sf[0][l] + 1;
      r = pr[0][r] - 1;
    } else if (h2 >= h3) {
      t += 'b';
      l = sf[1][l] + 1;
      r = pr[1][r] - 1;
    } else {
      t += 'c';
      l = sf[2][l] + 1;
      r = pr[2][r] - 1;
    }
  }
  cout << t;
  if (q) cout << g;
  reverse(t.begin(), t.end());
  cout << t;
  return 0;
}
