#include <bits/stdc++.h>
using namespace std;
string temp, P, g;
int n;
bool isp() {
  int n = temp.length();
  int e = (n + 1) / 2;
  for (__typeof(e) i = 0; i < e; ++i)
    if (temp[i] != temp[n - 1 - i]) return 0;
  return 1;
}
void f(int i = 0, int len = 0) {
  if (i == n) {
    if (len == 0) return;
    if (temp > P && isp()) P = temp;
    return;
  }
  f(i + 1, len);
  temp.push_back(g[i]);
  f(i + 1, len + 1);
  temp.pop_back();
}
int main() {
  cin >> g;
  P = g[0];
  n = g.length();
  f();
  cout << P;
  return 0;
}
