#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i;
  vector<char> v;
  string s;
  cin >> s;
  n = s.size();
  char c[n], ch;
  i = n;
  ch = s[n - 1];
  while (i--) {
    if (s[i] == ch)
      v.push_back(s[i]);
    else if (s[i] > ch) {
      v.push_back(s[i]);
      ch = s[i];
    }
  }
  for (i = v.size(); i > 0; i--) cout << v[i - 1];
}
