#include <bits/stdc++.h>
using namespace std;
char a[1 << 17];
int main() {
  char ch;
  int sz = 0;
  while ((ch = getchar()) != '\n') {
    if (!sz) {
      a[sz++] = ch;
      continue;
    }
    while (a[sz - 1] < ch) {
      --sz;
      if (!sz) break;
    }
    a[sz++] = ch;
  }
  a[sz] = '\0';
  printf("%s", a);
}
