#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ans;
  ios::sync_with_stdio(false);
  ;
  cin >> s;
  char now = 'a' - 1;
  reverse(s.begin(), s.end());
  for (int i = 0; i < s.length(); i++) {
    if (s[i] >= now) {
      now = s[i];
      ans += s[i];
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
