#include <bits/stdc++.h>
using namespace std;
bool isPowerOfTwo(long long int x) { return x && (!(x & (x - 1))); }
void solve() {
  string str, ans;
  cin >> str;
  int last = 0;
  for (char ch = 'z'; ch >= 'a'; --ch) {
    for (int i = last; i < str.size(); ++i) {
      if (str[i] == ch) {
        ans += ch;
        last = i;
      }
    }
  }
  cout << ans;
}
int32_t main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
