#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int start = 0;
  for (int i = 'z'; i >= 'a'; i--) {
    bool y = 0;
    int save = 0;
    for (int j = start; j < s.size(); j++) {
      if (s[j] == i) {
        y = 1;
        char a = i;
        cout << a;
        save = j;
      }
    }
    if (y == 1) start = save + 1;
  }
}
