#include <bits/stdc++.h>
using namespace std;
string s;
long long n, m, i, j, k, l, r;
vector<long long> a[11111];
int main() {
  cin >> s;
  k = s.size();
  for (i = 1; i <= k; i++) a[s[i - 1] - 'a' + 1].push_back(i);
  r = 0;
  for (i = 26; i >= 1; i--) {
    for (j = 0; j < a[i].size(); j++)
      if (r < a[i][j]) {
        cout << char(i + 'a' - 1);
        r = a[i][j];
      }
  }
}
