#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string ::iterator b = s.begin();
  while (b != s.end()) {
    b = max_element(b, s.end());
    string ::iterator e;
    for (auto i = b; i != s.end(); i++)
      if (*i == *b) {
        cout << *i;
        e = i;
      }
    b = e + 1;
    if (b == s.end()) break;
  }
  return 0;
}
