#include <bits/stdc++.h>
using namespace std;
void fileIO() {}
bool sortbysecdesc(const pair<long long, long long> &a,
                   const pair<long long, long long> &b) {
  return a.second > b.second;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fileIO();
  long long T;
  T = 1;
  while (T--) {
    string s;
    cin >> s;
    char last = s[0];
    long long index = 0;
    long long n = s.size();
    string ans = "";
    for (long long i = 1; i < n; i++) {
      if (s[i] > last) {
        last = s[i];
        index = i;
      }
    }
    for (long long i = index; i < n; i++) {
      if (s[i] == last) ans += s[i];
    }
    cout << ans << "\n";
  }
  return 0;
}
