#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int lst = -1;
  int n = s.size();
  for (char c = 'z'; c >= 'a'; c--) {
    for (int i = lst + 1; i < n; i++) {
      if (s[i] == c) {
        cout << c;
        lst = i;
      }
    }
  }
  return 0;
}
