#include <bits/stdc++.h>
using namespace std;
int main() {
  string input;
  int i, top;
  int save[100005];
  while (cin >> input) {
    char start = input[input.size() - 1];
    top = 1;
    save[0] = input.size() - 1;
    for (i = input.size() - 2; i >= 0; i--) {
      if (input[i] >= start) {
        start = input[i];
        save[top++] = i;
      }
    }
    for (i = top - 1; i >= 0; i--) cout << input[save[i]];
    cout << endl;
  }
  return 0;
}
