#include <bits/stdc++.h>
using namespace std;
int inline ABS(int a) {
  if (a > 0)
    return a;
  else
    return -a;
}
int GCD(int a, int b) {
  if (!a) return b;
  return GCD(b % a, a);
}
char s[111111];
int main() {
  scanf("%s", s);
  int big = 'a';
  string s1 = "";
  for (int i = strlen(s) - 1; i >= 0; i--) {
    if (s[i] >= big) {
      s1 += s[i];
      big = s[i];
    }
  }
  reverse(s1.begin(), s1.end());
  cout << s1;
  return 0;
}
