#include <bits/stdc++.h>
using namespace std;
set<string> st;
void printSubSeqRec(string str, int n, int index = -1, string curr = "") {
  if (index == n) return;
  if (!curr.empty()) {
    st.insert(curr);
  }
  for (int i = index + 1; i < n; i++) {
    curr += str[i];
    printSubSeqRec(str, n, i, curr);
    curr = curr.erase(curr.size() - 1);
  }
  return;
}
void printSubSeq(string str) { printSubSeqRec(str, str.size()); }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  string ans = "";
  printSubSeq(s);
  for (auto str : st) {
    string rev(str.rbegin(), str.rend());
    if (rev == str) {
      ans = max(ans, rev);
    }
  }
  cout << ans << "\n";
  return 0;
}
