#include <bits/stdc++.h>
const int N = 100020;
int stack[N];
char str[N];
int main() {
  int i, n, top = 0;
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (i = 1; i <= n; i++) {
    while (top && stack[top] < str[i]) top--;
    stack[++top] = str[i];
  }
  for (i = 1; i <= top; i++) putchar(stack[i]);
}
