#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t;
  cin >> s;
  for (int i = s.length() - 1; i >= 0; i--) {
    if (t == "") {
      t.push_back(s[i]);
    } else if (t.back() <= s[i]) {
      t.push_back(s[i]);
    }
  }
  reverse(t.begin(), t.end());
  cout << t;
}
