#include <bits/stdc++.h>
using namespace std;
char s[100005];
int f[100005];
int main() {
  scanf("%s", &s);
  int len = strlen(s);
  memset(f, -1, sizeof(f));
  int x = len - 1;
  for (int i = len - 2; i >= 0; i--) {
    f[i] = i + 1;
    if (f[i + 1] != -1 && s[f[i + 1]] > s[f[i]]) f[i] = f[i + 1];
    if (s[i] >= s[x]) x = i;
  }
  while (x != -1) {
    printf("%c", s[x]);
    x = f[x];
  }
  printf("\n");
  return 0;
}
