#include <bits/stdc++.h>
using namespace std;
const int mm = 111111;
char s[mm], f[mm];
int i, r, n;
int main() {
  while (~scanf("%s", s)) {
    n = strlen(s);
    r = -1;
    for (i = 0; i < n; ++i) {
      while (r >= 0 && f[r] < s[i]) --r;
      f[++r] = s[i];
    }
    f[r + 1] = '\0';
    puts(f);
  }
  return 0;
}
