#include <bits/stdc++.h>
int main() {
  char in[100010];
  int alpha[30];
  char dummy;
  while (scanf("%s%c", in, &dummy) != EOF) {
    for (int i = 0; i < 26; i++) {
      alpha[i] = -1;
    }
    int len = strlen(in);
    for (int i = 0; i < len; i++) {
      alpha[in[i] - 'a'] = i;
    }
    int j = 0;
    for (int i = 25; i >= 0; i--) {
      if (alpha[i] >= 0) {
        while (j <= alpha[i]) {
          if (in[j] == i + 'a') {
            printf("%c", in[j]);
          }
          j++;
        }
      }
    }
    printf("\n");
    in[0] = '\0';
  }
  return 0;
}
