#include <bits/stdc++.h>
using std::cin;
using std::cout;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::string S;
  cin >> S;
  std::string result;
  int start_pos = 0;
  int len = (int)S.size();
  for (char ch = 'z'; ch >= 'a'; --ch) {
    for (int i = start_pos; i < len; ++i) {
      if (S[i] == ch) {
        start_pos = i;
        result.push_back(ch);
      }
    }
  }
  cout << result << '\n';
  return 0;
}
