#include <bits/stdc++.h>
int main() {
  char s[100001], str[100001];
  int comp = 0, k = 0;
  scanf("%s", &s);
  for (int i = strlen(s) - 1; i >= 0; i--) {
    if (s[i] == comp)
      str[k++] = s[i];
    else if (s[i] > comp) {
      str[k++] = s[i];
      comp = s[i];
    }
  }
  for (int i = k - 1; i >= 0; i--) printf("%c", str[i]);
  return 0;
}
