#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int i, k = 0, j;
  cin >> s;
  for (i = 'z'; i >= 'a'; i--)
    for (j = k; j < s.length(); j++)
      if (s[j] == i) cout << s[j], k = j;
}
