#include <bits/stdc++.h>
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
using namespace std;
string s;
vector<int> pos[26];
bool read() {
  cin >> s;
  return true;
}
void solve() {
  int l = s.length();
  for (int i = 0; i < l; i++) {
    pos[s[i] - 'a'].push_back(i);
  }
  int prevlast = -1;
  for (char ch = 'z'; ch >= 'a'; ch--) {
    int v =
        (int)(pos[ch - 'a'].end() - upper_bound(pos[ch - 'a'].begin(),
                                                pos[ch - 'a'].end(), prevlast));
    int flag = 0;
    for (int i = 0; i < v; i++) {
      cout << ch;
      flag = 1;
    }
    if (flag == 1) break;
    if (pos[ch - 'a'].size() > 0 && v > 0)
      prevlast = pos[ch - 'a'][pos[ch - 'a'].size() - 1];
  }
}
int main() {
  read();
  solve();
}
