#include <bits/stdc++.h>
long marked[1000001], i, j;
using namespace std;
int main() {
  string s, res;
  cin >> s;
  res = s[s.size() - 1];
  char ch;
  ch = s[s.size() - 1];
  for (i = s.size() - 2; i >= 0; i--) {
    if (s[i] >= ch) {
      ch = s[i];
      res += s[i];
    }
  }
  reverse(res.begin(), res.end());
  cout << res << endl;
}
