#include <bits/stdc++.h>
using namespace std;
bool first(pair<char, int> a, pair<char, int> b) {
  if (a.first == b.first) return a.second < b.second;
  return a.first > b.first;
}
pair<char, int> a[100001];
int main() {
  string second;
  cin >> second;
  for (int i = 0; i < second.length(); i++)
    a[i].first = second[i], a[i].second = i;
  sort(a, a + second.length(), first);
  int idx = -1;
  for (int i = 0; i < second.length(); i++)
    if (a[i].second > idx) cout << a[i].first, idx = a[i].second;
  cout << endl;
  return 0;
}
