#include <bits/stdc++.h>
using namespace std;
char s[100005];
int n, curr, last[26];
int main() {
  scanf("%s", s);
  n = strlen(s);
  curr = 0;
  memset(last, -1, sizeof(last));
  for (int i = 0; i < n; i++) last[s[i] - 'a'] = i;
  for (char c = 'z'; c >= 'a'; c--) {
    if (last[c - 'a'] != -1) {
      for (int i = curr; i < n; i++)
        if (s[i] == c) printf("%c", c);
      curr = max(curr, last[c - 'a'] + 1);
    }
  }
  printf("\n");
  return 0;
}
