#include <bits/stdc++.h>
using namespace std;
char ch[100005];
char flag[100005];
int main() {
  scanf("%s", ch);
  memset(flag, false, sizeof(flag));
  int t = strlen(ch);
  int m, p, j;
  m = 0, p = 0;
  for (char i = 'z'; i >= 'a'; i--) {
    for (j = m; j < t; j++) {
      if (ch[j] == i) {
        flag[p++] = ch[j];
        m = j;
      }
    }
  }
  for (int k = 0; k < p; k++) {
    printf("%c", flag[k]);
  }
  printf("\n");
  return 0;
}
