#include <bits/stdc++.h>
using namespace std;
const int MAXL = (int)1e5 + 2;
char se[MAXL], mc[MAXL], an[MAXL], cmc;
int sel, pn;
int main(int argc, char const *argv[]) {
  gets(se);
  sel = strlen(se);
  cmc = 'a';
  for (int i = sel - 1; i >= 0; i--) {
    if (se[i] > cmc) cmc = se[i];
    mc[i] = cmc;
  }
  pn = 0;
  for (int i = 0; i < sel; i++) {
    if (se[i] == mc[i]) {
      an[pn++] = se[i];
    }
  }
  puts(an);
  return 0;
}
