#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int size = s.size();
  int start = 0;
  int t[26] = {0};
  int l[26] = {0};
  string res;
  while (start < size) {
    for (int i = start; i < size; i++) {
      t[s[i] - 'a'] += 1;
      l[s[i] - 'a'] = i;
    }
    for (int i = 'z' - 'a'; i >= 0; i--) {
      if (t[i] > 0) {
        for (int j = 0; j < t[i]; j++) res += 'a' + i;
        start = l[i] + 1;
        break;
      }
    }
    for (int i = 0; i < 26; i++) t[i] = 0;
  }
  cout << res;
  return 0;
}
