#include <bits/stdc++.h>
using namespace std;
bool isPal(string);
int main() {
  string str;
  cin >> str;
  string ans = "";
  vector<char> ma(str.size(), 'a');
  char maxi = 'a';
  for (int i = str.size() - 1; i >= 0; i--) {
    maxi = max(maxi, str[i]);
    ma[i] = maxi;
  }
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == ma[i]) ans += str[i];
  }
  cout << ans;
  return 0;
}
