#include <bits/stdc++.h>
using namespace std;
char str[100010];
int main() {
  int pre, next;
  while (gets(str)) {
    pre = 0;
    next = 0;
    string s = "";
    for (int i = 25; i >= 0; i--) {
      for (int j = pre; str[j]; j++) {
        if (str[j] - 'a' == i) {
          s += str[j];
          next = j;
        }
      }
      pre = next;
    }
    cout << s << endl;
  }
  return 0;
}
