#include <bits/stdc++.h>
const double eps = 1e-9;
const int int_inf = 1 << 31 - 1;
const long long i64_inf = 1ll << 63 - 1;
const double pi = acos(-1.0);
using namespace std;
char second[100500];
char ma[100500];
int id[100500];
int main() {
  gets(second);
  int n = (int)strlen(second);
  ma[n - 1] = second[n - 1];
  id[n - 1] = n - 1;
  for (int i = n - 2; i >= 0; i--) {
    ma[i] = second[i];
    id[i] = i;
    if (ma[i + 1] > ma[i]) {
      ma[i] = ma[i + 1];
      id[i] = id[i + 1];
    }
  }
  int i = 0;
  while (i <= n - 1) {
    printf("%c", ma[i]);
    i = id[i] + 1;
  }
  return 0;
}
