#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100050];
  scanf("%s", s);
  int len = strlen(s);
  int i, j;
  char a[28];
  int pointer = 1, ref = -1;
  a[0] = s[0];
  for (i = 1; i < len; i++) {
    for (j = 0; j < pointer; j++) {
      if (a[j] == s[i]) break;
      if (j == pointer - 1) {
        a[pointer] = s[i];
        pointer++;
      }
    }
  }
  sort(a, a + pointer);
  for (i = pointer - 1; i >= 0; i--) {
    for (j = ref + 1; j < len; j++) {
      if (a[i] == s[j]) {
        ref = j;
        printf("%c", s[j]);
      }
    }
  }
  cout << endl;
  return 0;
}
