#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  vector<int> occur[26];
  for (int i = s.size(); i--;) occur[s[i] - 'a'].push_back(i);
  for (int i = 26, pos = 0; i--;)
    for (int j = occur[i].size(); j--;)
      if (occur[i][j] >= pos) cout << char(i + 'a'), pos = occur[i][j] + 1;
  cout << '\n';
}
