#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[100005];
  cin >> a;
  string b = a;
  set<char> p(a, a + strlen(a));
  set<char>::iterator t = p.end();
  t--;
  while (!b.empty()) {
    while (b.find(*t) < b.size() && b.find(*t) >= 0) {
      cout << (*t);
      b.erase(b.begin(), b.begin() + b.find(*t) + 1);
    }
    t--;
  }
  return 0;
}
