#include <bits/stdc++.h>
int main() {
  char s[100001], h[100001];
  long l, i, j;
  while (gets(s)) {
    l = strlen(s);
    j = 0;
    h[j++] = s[l - 1];
    for (i = l - 2; i >= 0; i--) {
      if (s[i] >= h[j - 1]) {
        h[j++] = s[i];
      }
    }
    h[j] = '\0';
    for (i = 0; i < j; i++) {
      s[i] = h[j - i - 1];
    }
    s[i] = '\0';
    printf("%s\n", s);
  }
  return 0;
}
