#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 1e3 + 10;
int a[N];
int b[N];
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int main() {
  string str;
  string ans;
  cin >> str;
  for (auto &c : str) {
    while (!ans.empty() && ans.back() < c) ans.pop_back();
    ans.push_back(c);
  }
  cout << ans << endl;
  return 0;
}
