#include <bits/stdc++.h>
char s[100010];
char s2[100010];
int main() {
  scanf("%s", s);
  int t = 0;
  for (int i = 0; s[i]; i++) {
    while (t >= 0 && s2[t] < s[i]) t--;
    ++t;
    s2[t] = s[i];
  }
  s2[++t] = '\0';
  printf("%s\n", s2);
  return 0;
}
