#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, t = 1;
  string s;
  cin >> s;
  map<char, int> m;
  map<char, int>::iterator it;
  for (i = 0; i < s.size(); i++) m[s[i]] = i + 1;
  for (i = 122; i >= 97; i--) {
    if (m[char(i)]) {
      for (j = t - 1; j < m[char(i)] && j < s.size(); j++) {
        if (s[j] == char(i)) {
          cout << s[j];
          t = m[char(i)];
        }
      }
    }
  }
  cout << endl;
  return 0;
}
