#include <bits/stdc++.h>
int main() {
  char s[100001];
  int i, j = 0;
  int *c = new int[26];
  for (i = 0; i < 26; i++) c[i] = 0;
  scanf("%s", s);
  for (i = 0; s[i] != '\0'; i++) c[s[i] - 97]++;
  for (i = 25; i >= 0; i--)
    while (c[i]) {
      for (j; s[j] != '\0' && s[j] - 97 != i; j++) c[s[j] - 97]--;
      if (s[j] != '\0') printf("%c", s[j]);
      c[i]--;
      if (s[j] == '\0') return 0;
      j++;
    }
}
