#include <bits/stdc++.h>
using namespace std;
int i, j, k, m, n, l;
char s[100047];
char f[100047];
int main() {
  scanf("%s", s);
  memset(f, 0, sizeof(f));
  n = strlen(s);
  for (i = n - 1; i >= 0; i--) f[i] = max(f[i + 1], s[i]);
  for (i = 0; i < n; i++)
    if (s[i] == f[i]) printf("%c", s[i]);
  printf("\n");
  return 0;
}
