#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
void solve() {
  string s;
  cin >> s;
  int n = s.size(), last = -1;
  string t = "";
  for (char i = 'z'; i >= 'a'; i--) {
    if (last >= n) break;
    for (int j = last + 1; j < n; j++) {
      if (s[j] == i) t += s[j], last = j;
    }
  }
  cout << t << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
