#include <bits/stdc++.h>
using namespace std;
long long int MOD = 998244353;
long long int mod = 1e9 + 7;
long long int inf = 1e9 + 5;
void mini(long long int &a, long long int b) { a = min(a, b); }
void maxi(long long int &a, long long int b) { a = max(a, b); }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    string s;
    cin >> s;
    long long int n = s.size();
    string ans;
    long long int curr = 0;
    for (char c = 'z'; c >= 'a'; c--) {
      for (long long int i = curr; i < n; i++) {
        if (s[i] == c) {
          ans.push_back(c);
          curr = i;
        }
      }
    }
    cout << ans;
  }
  cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
}
