#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, ans;
  cin >> s;
  ans = s[s.size() - 1];
  char nn = s[s.size() - 1];
  for (int i = s.size() - 2; i >= 0; i--) {
    if (s[i] >= nn) {
      ans += s[i];
      nn = s[i];
    }
  }
  reverse(ans.begin(), ans.end());
  cout << ans;
  return 0;
}
