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