#include <bits/stdc++.h>
using namespace std;
char s[110000];
char res[110000];
int main() {
  scanf("%s", s);
  int resLen = 0;
  int last = 0;
  int index = 0;
  for (int i = 0; i < 110000; i++) res[i] = 0;
  for (char c = 'z'; c >= 'a'; c--)
    for (int i = index; s[i]; i++)
      if (s[i] == c) {
        res[resLen] = c;
        resLen++;
        index = i + 1;
      }
  printf("%s\n", res);
  return 0;
}
