#include <bits/stdc++.h>
using namespace std;
const int infint = INT_MAX;
const long long infll = LLONG_MAX;
const int MAX = 1e5 + 100;
char mx[MAX];
int main() {
  string a;
  cin >> a;
  string res = "";
  memset(mx, 0, sizeof(mx));
  for (int i = a.length() - 1; i >= 0; i--) {
    mx[i] = max(mx[i + 1], a[i]);
  }
  for (int i = 0; i < a.length(); i++) {
    if (mx[i] == a[i]) res += a[i];
  }
  cout << res;
  return 0;
}
