#include <bits/stdc++.h>
int main() {
  std::string s;
  std::cin >> s;
  char last_max = 0;
  std::deque<char> solution;
  for (size_t i = s.length(); i > 0; i--) {
    if (s[i - 1] >= last_max) {
      solution.push_front(s[i - 1]);
    }
    if (s[i - 1] > last_max) last_max = s[i - 1];
  }
  for (auto it = solution.begin(); it != solution.end(); it++) std::cout << *it;
  return 0;
}
