#include <bits/stdc++.h>
int len, max_index = -1;
char max_;
char mas[100001];
int main(void) {
  gets(mas);
  len = strlen(mas);
  for (int k = 0; k < 26; ++k) {
    max_ = 0;
    for (int i = max_index + 1; i < len; ++i) {
      if (mas[i] > max_) {
        max_ = mas[i];
        max_index = i;
      }
    }
    for (int i = max_index; i < len; ++i) {
      if (mas[i] == max_ && max_ != 0) {
        max_index = i;
        printf("%c", max_);
        mas[i] = 0;
      }
    }
  }
  return 0;
}
