#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ss;
  int kol[30], b[30], e[30];
  cin >> s;
  ss = s[s.size() - 1];
  int j = 0;
  for (int i = s.size() - 2; i >= 0; i--)
    if (s[i] >= ss[j]) {
      ss += s[i];
      j++;
    }
  reverse(ss.begin(), ss.end());
  cout << ss;
  return 0;
}
