#include <bits/stdc++.h>
using namespace std;
char s[100005];
char b[100005];
int main() {
  cin >> s;
  int cnt = 0;
  char x = 'a';
  for (int i = strlen(s); i >= 0; --i) {
    if (s[i] >= x) {
      x = s[i];
      b[cnt++] = x;
    }
  }
  while (cnt--) {
    printf("%c", b[cnt]);
  }
  return 0;
}
