#include <bits/stdc++.h>
using namespace std;
char s1[100005], s2[100005];
int main() {
  int len;
  char *p, *q, c;
  scanf("%s", s1);
  strcpy(s2, s1);
  len = strlen(s1);
  sort(s1, s1 + len);
  len -= 1;
  p = s2;
  while (len >= 0) {
    c = s1[len];
    q = strchr(p, c);
    if (q != NULL) {
      printf("%c", c);
      p = q + 1;
    }
    len--;
  }
  return 0;
}
