#include <bits/stdc++.h>
char stack[100005];
int top;
int main() {
  char c;
  int begin, end, mid, i;
  while ((c = getchar()) != '\n') {
    if (top == 0 || c <= stack[top - 1]) {
      stack[top++] = c;
    } else {
      begin = 0;
      end = top - 1;
      while (begin < end) {
        mid = (begin + end) / 2;
        if (stack[mid] < c)
          end = mid;
        else {
          begin = mid + 1;
        }
      }
      stack[begin] = c;
      top = begin + 1;
    }
  }
  for (i = 0; i < top; i++) putchar(stack[i]);
  putchar('\n');
  return 0;
}
