#include <bits/stdc++.h>
using namespace std;
char s[100005];
int f[100005];
char ch;
int main() {
  while (scanf("%s", s) != EOF) {
    int len = strlen(s);
    ch = s[len - 1];
    int u = len - 1, i;
    for (i = len - 1; i >= 0; i--) {
      if (s[i] >= ch) {
        u = i;
        f[i] = u;
        ch = s[i];
      } else
        f[i] = u;
    }
    int j = 0;
    for (i = 1; i < len; i++)
      if (f[i] != f[j]) f[++j] = f[i];
    for (i = 0; i <= j; i++) printf("%c", s[f[i]]);
    printf("\n");
  }
  return 0;
}
