#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  if (!s.length()) {
    cout << "";
    return 0;
  }
  string mx = "";
  char mxC = s.back();
  mx += mxC;
  for (int i = s.length() - 2; i >= 0; --i) {
    if (s[i] >= mxC) {
      mx += s[i];
      mxC = s[i];
    }
  }
  cout << string(mx.rbegin(), mx.rend());
  return 0;
}
