#include <bits/stdc++.h>
const int MAXN = 100010;
char ans[MAXN];
char str[MAXN];
int main() {
  scanf("%s", str);
  int n = strlen(str);
  int i = 1;
  ans[1] = str[n - 1];
  for (int j = n - 2; j >= 0; j--)
    if (str[j] >= ans[i]) ans[++i] = str[j];
  for (int j = i; j >= 1; j--) printf("%c", ans[j]);
}
