#include <bits/stdc++.h>
using namespace std;
template <class T>
bool up_max(T& a, const T& b) {
  return b > a ? a = b, 1 : 0;
}
template <class T>
bool up_min(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
int n;
bool f[100020];
char ch[100020];
int main() {
  while (scanf("%s", ch) != EOF) {
    n = strlen(ch);
    memset(f, 0, sizeof(f));
    ;
    char t = 'a';
    for (int i = n - 1; i >= 0; --i) {
      if (ch[i] >= t) {
        t = ch[i];
        f[i] = 1;
      }
    }
    for (int i = 0; i < n; ++i) {
      if (f[i]) printf("%c", ch[i]);
    }
    puts("");
  }
}
