#include <bits/stdc++.h>
using namespace std;
int L;
char str[100047];
char naj[100047];
int main() {
  scanf("%s", str);
  L = strlen(str);
  naj[L] = 'a';
  for (int i = 0; i < (L); ++i)
    naj[L - i - 1] = max(str[L - i - 1], naj[L - i]);
  for (int i = 0; i < (L); ++i)
    if (str[i] == naj[i]) printf("%c", str[i]);
  printf("\n");
}
