#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  char prev = s[0];
  string t;
  for (int i = 1; i < s.size(); i++) {
    if (prev <= s[i]) t += prev, prev = s[i];
  }
  t += prev;
  reverse(t.begin(), t.end());
  cout << t << endl;
  return 0;
}
