#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int i, j, k;
  string s;
  cin >> s;
  vector<int> a[26];
  for (i = 0; i < s.length(); i++) {
    a[s[i] - 'a'].push_back(i);
  }
  int first = 0, lastcount = 0;
  for (i = 25; i >= 0; i--) {
    if (a[i].size() != 0) {
      if (!first) {
        for (j = 0; j < a[i].size(); j++) cout << char(i + 'a');
        first = 1;
        lastcount = a[i][a[i].size() - 1];
      } else {
        for (j = 0; j < a[i].size(); j++) {
          if (a[i][j] > lastcount) {
            cout << char(i + 'a');
            lastcount = a[i][j];
          }
        }
      }
    }
  }
  cout << endl;
  return 0;
}
