#include <bits/stdc++.h>
using namespace std;
char res[100000];
int main() {
  int n = 0, c = 0;
  string str;
  cin >> str;
  for (int i = str.size() - 1; i >= 0; i--) {
    if (str[i] >= c) {
      res[n++] = str[i];
      c = str[i];
    }
  }
  for (int i = n - 1; i >= 0; i--) cout << res[i];
}
