#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  char c = 'a';
  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] >= c) {
      c = s[i];
      continue;
    } else {
      s.erase(i, 1);
    };
  };
  cout << s;
  return 0;
}
