#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  long long int i, j, curr = 0;
  for (i = 'z'; i >= 'a'; i--) {
    for (j = curr; j < s.length(); j++) {
      if (s[j] == i) {
        cout << s[j];
        curr = j + 1;
      }
    }
  }
}
