#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  string s;
  cin >> s;
  map<char, int, greater<int>> data;
  for (int i = 0; i < s.length(); ++i) {
    data[s[i]]++;
  }
  int count = 0;
  auto now = data.begin();
  for (int i = 0; i < s.length(); ++i) {
    data[s[i]]--;
    if (s[i] == now->first) {
      cout << s[i];
    }
    while (now->second == 0) now++;
  }
}
