#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int N = s.length();
  char maxsuff[N];
  maxsuff[N - 1] = s[N - 1];
  for (int i = N - 2; i >= 0; --i) {
    maxsuff[i] = max(maxsuff[i + 1], s[i]);
  }
  for (int i = 0; i < N; ++i) {
    if (s[i] == maxsuff[i]) cout << s[i];
  }
  cout << endl;
  return 0;
}
