#include <bits/stdc++.h>
using namespace std;
char s[100010];
char ans[100010];
int run;
int main() {
  int now = 0, ind;
  scanf("%s", s);
  int k = strlen(s);
  for (int i = 25; i >= 0; i--) {
    ind = -1;
    for (int j = now; j < k; j++) {
      if (s[j] == 'a' + i) {
        ans[run++] = 'a' + i;
        ind = j;
      }
    }
    if (ind >= 0) now = ind + 1;
  }
  for (int i = 0; i < run; i++) printf("%c", ans[i]);
  scanf(" ");
}
