#include <bits/stdc++.h>
using namespace std;
char a[100002];
int p[100002];
int b;
char big = 'A';
int bigpos = -1;
int vec[30];
int main() {
  scanf("%s", a);
  b = strlen(a);
  for (int i = 0; i < b; i++) {
    vec[a[i] - 97] = i;
    ;
    if (a[i] > big) {
      bigpos = i;
      big = a[i];
    }
  }
  big -= 97;
  int limit = -1;
  int p = 0;
  for (int i = big; i >= 0; i--) {
    if (p <= vec[i]) {
      while (p <= vec[i]) {
        if (a[p] == (i + 97)) printf("%c", a[p]);
        p++;
      }
    }
  }
  printf("\n");
  return 0;
}
