#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int size = s.size();
  int index = 0;
  char x = 'z';
  string jawab = "";
  while (x >= 'a') {
    for (int i = index; i < size; i++) {
      if (s[i] == x) {
        index = i;
        jawab += s[i];
      }
    }
    x--;
  }
  cout << jawab << endl;
}
