#include <bits/stdc++.h>
using namespace std;
int main() {
  static char S[100000], Max[100000];
  int N = 0;
  char c;
  while (c = getchar(), c >= 'a' && c <= 'z') S[N++] = c;
  Max[N - 1] = S[N - 1];
  for (int i = N - 2; i >= 0; i--) Max[i] = max(Max[i + 1], S[i]);
  for (int i = 0; i < N; i++)
    if (S[i] == Max[i]) putchar(S[i]);
  putchar('\n');
  return 0;
}
