#include <bits/stdc++.h>
using namespace std;
int main() {
  int d[26];
  int index[100001];
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < 26; i++) {
    index[i] = 0;
    d[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    index[i] = d[(s[i] - 'a')];
    d[(s[i] - 'a')]++;
  }
  string res = "";
  int j = 0;
  for (int i = 25; i >= 0; i--) {
    if (0 < d[i]) {
      for (; j < n; j++) {
        d[(s[j] - 'a')]--;
        if ((int)(s[j] - 'a') == i) {
          res += s[j];
          if (d[i] == 0) break;
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}
