#include <bits/stdc++.h>
char c1[100101];
char c2[100100];
int main() {
  gets(c1);
  int i;
  int l = strlen(c1);
  char c = 'a';
  int t = 0;
  for (i = l - 1; i >= 0; i--) {
    if (c1[i] > c) {
      c = c1[i];
      c2[t++] = c1[i];
    } else if (c1[i] == c) {
      c2[t++] = c1[i];
    }
  }
  t--;
  for (; t >= 0; t--) {
    printf("%c", c2[t]);
  }
  printf("\n");
  return 0;
}
