#include <bits/stdc++.h>
int main() {
  int i, j, k = 0, l, m, alp[26] = {0};
  char s[100002];
  char ch;
  scanf("%s", s);
  l = strlen(s);
  for (i = 0; i < l; i++) {
    m = (int)s[i];
    alp[m - 97] = m;
  }
  j = 0;
  for (i = 25; i >= 0; i--) {
    if (alp[i] != 0) {
      for (k = j; k < l; k++) {
        if (s[k] == (char)alp[i]) {
          printf("%c", s[k]);
          j = k;
        }
        if (j == l - 1) return (0);
      }
    }
  }
}
