#include <bits/stdc++.h>
using namespace std;
string str;
bool ispalin(string st) {
  int high, low;
  high = (int)st.size() - 1;
  low = 0;
  while (low < high) {
    if (st[low++] != st[high--]) return false;
  }
  return true;
}
string vise(int a) {
  string ans = "";
  int ind = str.size();
  ind--;
  for (int mask = 1; mask <= a && ind >= 0; mask <<= 1, ind--) {
    if (mask & a) ans = str[ind] + ans;
  }
  return ans;
}
int _pow(int a, int b) {
  int ans = 1;
  while (b--) ans *= a;
  return ans;
}
int main() {
  vector<string> v;
  while (getline(cin, str)) {
    v.clear();
    long long sz = _pow(2, str.size());
    for (int i = 1; i <= sz; ++i) {
      string ans = vise(i);
      if (ispalin(ans)) {
        v.push_back(ans);
      }
    }
    sort((v).begin(), (v).end());
    cout << v[(int)v.size() - 1] << endl;
  }
  return 0;
}
