#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  string rev = "", ans = "";
  char currMax = 'a';
  for (int i = s.length() - 1; i >= 0; i--) {
    if (s[i] >= currMax) {
      currMax = s[i];
      rev += s[i];
    }
  }
  for (int i = rev.length() - 1; i >= 0; i--) {
    ans += rev[i];
  }
  cout << ans << endl;
  return 0;
}
