#include <bits/stdc++.h>
#pragma warning(disable : 4786)
#pragma comment(linker, "/STACK:16777216")
using namespace std;
char str[100005];
char a[100005];
int ln;
int N, K;
set<char> S;
int main() {
  int i, j, k, p;
  while (scanf("%s", str) == 1) {
    S.clear();
    ln = strlen(str);
    N = ln;
    for (i = 0; i < ln; i++) S.insert(str[i]);
    set<char>::iterator it;
    K = S.size();
    for (i = 0, it = S.begin(); it != S.end(); it++, i++) {
      a[i] = *it;
    }
    reverse(a, a + K);
    i = 0;
    j = 0;
    k = 0;
    while (true) {
      for (; i < ln; i++)
        if (str[i] == a[k]) break;
      if (str[i] == a[k]) {
        for (; i < ln; i++) {
          if (a[k] == str[i]) {
            printf("%c", str[i]);
            p = i;
          }
        }
      }
      k++;
      i = p + 1;
      if (k == K) break;
    }
    printf("\n");
  }
  return 0;
}
