#include <bits/stdc++.h>
using namespace std;
char s[100001];
char ans[100001];
int main() {
  char head = 0;
  scanf("%s", s);
  int j = -1;
  for (int i = strlen(s) - 1; i >= 0; i--) {
    if (s[i] >= head) {
      ans[++j] = s[i];
      head = s[i];
    }
  }
  for (int i = strlen(ans) - 1; i >= 0; i--) putchar(ans[i]);
  printf("\n");
  return 0;
}
