#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int n;
char a[MAX];
pair<char, int> b[MAX];
int main() {
  cin >> (a + 1);
  n = strlen(a + 1);
  for (int i = 1; i <= n; ++i) {
    b[i].first = a[i];
    b[i].second = i;
  }
  sort(b + 1, b + n + 1,
       [&](const pair<char, int> &a, const pair<char, int> &b) {
         if (a.first == b.first) {
           return a.second < b.second;
         }
         return a.first > b.first;
       });
  for (int i = 1, j = 0; i <= n; ++i) {
    if (j < b[i].second) {
      cout << b[i].first;
      j = b[i].second;
    }
  }
  cout << '\n';
}
