#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char s[N];
int f[N];
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  f[len] = s[len];
  for (int i = len - 1; i >= 1; i--) {
    f[i] = max(int(f[i + 1]), int(s[i]));
  }
  for (int i = 1; i <= len; i++) {
    if (s[i] == f[i]) {
      cout << s[i];
    }
  }
  cout << endl;
  return 0;
}
