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