#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int n = s.size(), p = 0;
  string ans = "";
  for (char c = 'z'; c >= 'a'; c--) {
    int l = p - 1;
    for (int i = p; i < n; i++) {
      if (s[i] == c) {
        ans += s[i];
        l = i;
      }
    }
    p = l + 1;
  }
  cout << ans << "\n";
  return 0;
}
