#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string s;
  cin >> s;
  long long ind = 0;
  for (char ch = 'z'; ch >= 'a'; ch--) {
    long long last = ind;
    for (long long i = ind; i < s.size(); i++) {
      if (s[i] == ch) {
        cout << ch;
        last = i;
      }
    }
    ind = last;
  }
  cout << endl;
  return 0;
}
