#include <bits/stdc++.h>
using namespace std;
string input, hasil = "";
int ujung = 0;
int main() {
  ios::sync_with_stdio(false);
  cin >> input;
  for (int i = 'z'; i >= 'a'; i--) {
    for (int j = ujung; j < (int)input.length(); j++) {
      if (input[j] == i) {
        hasil += i;
        ujung = j;
      }
    }
  }
  cout << hasil << '\n';
  fprintf(stderr, "%.3lf\n", clock() / (double)CLOCKS_PER_SEC);
}
