#include <bits/stdc++.h>
using namespace std;
int main() {
  string l, r = "";
  cin >> l;
  int j = l[l.size() - 1];
  for (int i = l.size() - 1; i >= 0; i--) {
    if (j <= l[i]) {
      r = l[i] + r;
      j = l[i];
    }
  }
  cout << r << endl;
  return 0;
}
