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