#include <bits/stdc++.h>
using namespace std;
char s1[100005], s2[100005];
int main() {
  int l1, l2, i;
  char tmp;
  while (~scanf("%s", s1)) {
    l1 = strlen(s1);
    for (i = l1 - 1, l2 = 0, tmp = 0; i >= 0; i--) {
      if (s1[i] >= tmp) {
        tmp = s1[i];
        s2[l2++] = s1[i];
      }
    }
    for (i = l2 - 1; i >= 0; i--) {
      printf("%c", s2[i]);
    }
    printf("\n");
  }
  return 0;
}
