#include <bits/stdc++.h>
using namespace std;
string s;
int ma = 65;
int main() {
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    ma = max(ma, (int)s[i]);
  }
  int i = 0, p;
  while (i < s.size()) {
    for (; i < s.size(); i++) {
      if (s[i] == (char)ma) {
        cout << s[i];
        p = i;
      }
    }
    i = p + 1;
    --ma;
  }
  cout << '\n';
}
