#include <bits/stdc++.h>
using namespace std;
char ch[200000], ch1;
int i, len;
int main() {
  scanf("%s", ch);
  len = strlen(ch);
  int beg = 0;
  for (ch1 = 'z'; ch1 >= 'a'; --ch1) {
    for (int i = beg; i < len; ++i)
      if (ch[i] == ch1) printf("%c", ch1), beg = i + 1;
    if (beg >= len) break;
  }
  return 0;
}
