#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) {
    string s;
    cin >> s;
    int n = s.size();
    vector<char> ans;
    ans.push_back(s[n - 1]);
    char mini = s[n - 1];
    for (int i = n - 2; i >= 0; i--) {
      if (s[i] >= mini) {
        ans.push_back(s[i]);
        mini = s[i];
      }
    }
    reverse(ans.begin(), ans.end());
    for (auto i : ans) cout << i;
  }
}
