#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int a[26] = {0};
  for (int i = 0; i < s.length(); ++i) {
    a[s[i] - 'a']++;
  }
  string ans = "";
  int last = 0;
  for (int j = 25; j >= 0; --j) {
    if (!a[j]) continue;
    for (int i = last; i < s.length(); ++i) {
      if (s[i] - 'a' == j) {
        ans += s[i];
        last = i;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
