#include <bits/stdc++.h>
using namespace std;
const int Mx = 1e5 + 5;
char ch[Mx];
int len, q[Mx], top;
int main() {
  scanf("%s", ch + 1);
  len = strlen(ch + 1);
  for (int i = 1; i <= len; i++) {
    while (ch[i] > ch[q[top]] && top > 0) top--;
    q[++top] = i;
  }
  for (int i = 1; i <= top; i++) putchar(ch[q[i]]);
}
