#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  string str, Ans = "";
  char Cur = '#';
  cin >> str;
  reverse(str.begin(), str.end());
  for (int i = 0; i < (int)str.length(); ++i) {
    if (Cur == '#' || Cur <= str[i]) {
      Cur = str[i];
      Ans += Cur;
    }
  }
  reverse(Ans.begin(), Ans.end());
  cout << Ans << " ";
  return 0;
}
