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