#include <bits/stdc++.h>
using namespace std;
int H[30][100003];
int pos[30];
int main() {
  int i, j;
  char str[1000000];
  cin >> str;
  for (i = 0; i < 30; i++) pos[i] = 0;
  for (i = 0; str[i] != 0; i++) {
    H[str[i] - 'a'][pos[str[i] - 'a']++] = i;
  }
  int ap = -1;
  for (char ch = 'z'; ch >= 'a'; ch--) {
    for (i = 0; i < pos[ch - 'a']; i++) {
      if (H[ch - 'a'][i] > ap) {
        ap = H[ch - 'a'][i];
        printf("%c", ch);
      }
    }
  }
  cout << endl;
  return 0;
}
