#include <bits/stdc++.h>
using namespace std;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string str, ans;
  cin >> str;
  char max = 1;
  for (int i = str.length() - 1; i >= 0; i--)
    if (str[i] >= max) max = str[i], ans += str[i];
  for (int i = ans.length() - 1; i >= 0; i--) cout << ans[i];
  return 0;
}
