#include <bits/stdc++.h>
int main() {
  char s[100003], ans[100003];
  int k = 0;
  scanf("%s", s);
  int l = strlen(s);
  for (int i = 0; i != l; ++i) {
    while (k != 0 && s[i] > ans[k - 1]) --k;
    ans[k] = s[i];
    ++k;
  }
  for (int i = 0; i != k; ++i) printf("%c", ans[i]);
  return 0;
}
