#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long int len = s.length();
  char rish[len];
  long int rishC = 0;
  rish[rishC++] = s[len - 1];
  long int val = s[len - 1];
  for (long int i = len - 2; i >= 0; i--) {
    if (s[i] >= val) {
      val = s[i];
      rish[rishC++] = s[i];
    }
  }
  for (long int i = rishC - 1; i >= 0; i--) cout << rish[i];
  return 0;
}
