#include <bits/stdc++.h>
using namespace std;
string s, t;
int main() {
  cin >> s;
  for (int i = s.length() - 1; i >= 0; --i) {
    if (!t.length() || s[i] >= t[0]) {
      t = s[i] + t;
    }
  }
  cout << t << endl;
  return 0;
}
