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