#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.size();
  string rev_ans;
  rev_ans += str[n - 1];
  for (int i = n - 2; i >= 0; --i) {
    if (str[i] >= rev_ans[rev_ans.length() - 1]) {
      rev_ans += str[i];
    }
  }
  reverse(rev_ans.begin(), rev_ans.end());
  cout << rev_ans << endl;
}
