#include <bits/stdc++.h>
using namespace std;
int dx[]{0, 0, 1, -1, -1, 1, 1, -1};
int dy[]{-1, 1, 0, 0, 1, 1, -1, -1};
void file() {}
const int N = 100, mod = 1e9 + 7;
string s;
vector<int> adj[3], nadj[3];
int dp[N];
int solve(int idx, int lst) {
  if (idx >= lst) return 0;
  int ret = solve(idx + 1, lst);
  for (int i = 0; i < 3; i++) {
    auto id = upper_bound(((adj[i]).begin()), ((adj[i]).end()), idx);
    if (id != adj[i].end()) {
      auto idlst = upper_bound(((nadj[i]).begin()), ((nadj[i]).end()), -lst);
      if (idlst != nadj[i].end()) {
        if (-*idlst > *id)
          ret = max(ret, solve(*id, -*idlst) + 2);
        else if (-*idlst == *id)
          ret = max(ret, solve(*id, -*idlst) + 1);
      }
    }
  }
  return ret;
}
string a, b;
void build(int idx, int lst) {
  if (idx >= lst) return;
  int opt = solve(idx, lst);
  for (int i = 0; i < 3; i++) {
    auto id = upper_bound(((adj[i]).begin()), ((adj[i]).end()), idx);
    if (id != adj[i].end()) {
      auto idlst = upper_bound(((nadj[i]).begin()), ((nadj[i]).end()), -lst);
      if (idlst != nadj[i].end()) {
        if (-*idlst > *id) {
          if (opt == solve(*id, -*idlst) + 2) {
            a += s[*id];
            b += s[-*idlst];
            build(*id, -*idlst);
            return;
          }
        } else if (-*idlst == *id) {
          if (opt == solve(*id, -*idlst) + 1) {
            a += s[*id];
            build(*id, -*idlst);
            return;
          }
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  file();
  cin >> s;
  int l = 0, r = ((int)(s).size()) - 1;
  while (l <= r) {
    if (s[l] == s[r]) {
      a += s[l];
      if (l != r) b += s[r];
      l++, r--;
    } else {
      if (s[l + 1] == s[r])
        l++;
      else
        r--;
    }
  }
  reverse(((b).begin()), ((b).end()));
  a += b;
  cout << a << "\n";
}
