#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ans;
  char rank;
  int i, len, last;
  cin >> s;
  while (!cin.fail()) {
    len = s.size();
    ans = "";
    rank = 'a';
    last = 0;
    while (last < len) {
      for (i = last; i < len; i++) {
        if (s[i] == rank) {
          ans.push_back(s[i]);
          last = i + 1;
        } else if (s[i] > rank) {
          ans = "";
          ans.push_back(s[i]);
          rank = s[i];
          last = i + 1;
        }
      }
      cout << ans;
      ans = "";
      rank = 'a';
    }
    cout << endl;
    cin >> s;
  }
  return 0;
}
