#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s1;
  cin >> s;
  int l = s.length();
  s1 = s[l - 1];
  char c = s[l - 1];
  for (int i = l - 2; i >= 0; i--) {
    if (c > s[i])
      continue;
    else {
      c = s[i];
      s1 += c;
    }
  }
  reverse(s1.begin(), s1.end());
  cout << s1 << endl;
  return 0;
}
