#include <bits/stdc++.h>
using namespace std;
char a[300000];
int32_t main() {
  string s;
  cin >> s;
  long long n = s.size();
  char mx = 'a' - 1;
  for (long long i = n - 1; i > -1; i--) {
    mx = max(mx, s[i]);
    a[i] = mx;
  }
  string k;
  for (long long i = 0; i < n; i++) {
    if (s[i] == a[i]) k += s[i];
  }
  cout << k << endl;
}
