#include <bits/stdc++.h>
char s[1000000];
char ans[1000000];
int main() {
  int i, len, cnt;
  char max = 0;
  while (scanf("%s", s) != EOF) {
    max = 0;
    cnt = 1000000 - 1;
    len = strlen(s);
    for (i = len - 1; i >= 0; i--) {
      if (s[i] >= max) {
        max = s[i];
        ans[cnt--] = s[i];
      }
    }
    for (i = cnt + 1; i < 1000000; i++) printf("%c", ans[i]);
    printf("\n");
  }
  return 0;
}
