#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  string ans = "";
  ans = ans + s[0];
  char max = s[0];
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] >= max) {
      ans = s[i] + ans;
      max = s[i];
    }
  }
  cout << ans << endl;
  return 0;
}
