#include <bits/stdc++.h>
using namespace std;
int main() {
  char st[100009], ans[100009];
  int index = 0;
  char last, temp;
  scanf("%s", st);
  int len = strlen(st);
  last = 'a';
  for (int i = len - 1; i >= 0; i--) {
    if (st[i] >= last) {
      ans[index++] = st[i];
      last = st[i];
    }
  }
  for (int i = index - 1; i >= 0; i--) printf("%c", ans[i]);
  cout << endl;
  return 0;
}
