#include <bits/stdc++.h>
char a[100009];
int s = 0, t[30], x = 0, x1 = 0, p[30], p1 = 0;
int main() {
  scanf("%s", a);
  int lena = strlen(a);
  for (int h = 0; h < lena; h++) t[a[h] - 97] = 1;
  for (int h = 26; h > -1; h--) p[p1++] = h;
  for (int h = 0; h < p1; h++) {
    for (int j = x; j < lena; j++)
      if (a[j] - 97 == p[h]) {
        printf("%c", a[j]);
        x1 = j;
      }
    x = x1;
  }
  return 0;
}
