#include <bits/stdc++.h>
char str[100005], stack[100005];
int top = 0, s;
int main(void) {
  int i;
  scanf("%s", str + 1);
  s = strlen(str + 1);
  for (i = 1; i <= s; i++) {
    while (top > 0 && stack[top] < str[i]) {
      top--;
    }
    stack[++top] = str[i];
  }
  for (i = 1; i <= top; i++) printf("%c", stack[i]);
  printf("\n");
  return 0;
}
