#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, s1, sf;
  cin >> s;
  long long int len, i, x, y;
  len = s.size();
  char d;
  s1 = s;
  d = s[len - 1];
  for (i = len - 2; i >= 0; i--) {
    if (s[i] > d) {
      s1[i] = s[i];
      d = s[i];
    } else
      s1[i] = d;
  }
  for (i = 0; i < len; i++) {
    if (s1[i] == s[i]) sf.push_back(s1[i]);
  }
  cout << sf;
}
