#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int pos = 0;
  cin >> s;
  for (char c = 'z'; c >= 'a'; --c) {
    for (int i = pos; i < s.length(); i++) {
      if (s[i] == c) {
        cout << c;
        pos = i;
      }
    }
  }
}
