#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
int Unset(int a, int i) {
  int mask;
  mask = 1 << i;
  a = a & ~mask;
  return a;
}
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
int power(int x, int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0) {
    int y = power(x, n / 2);
    return y * y;
  } else
    return x * power(x, n - 1);
}
vector<int> v1[30];
int main() {
  ios_base::sync_with_stdio(0);
  string x, ans;
  ans = "";
  cin >> x;
  for (int A = 0; A < x.size(); A++) {
    int t = x[A] - 'a';
    v1[t].push_back(A);
  }
  stack<int> s1;
  for (int A = 25; A >= 0; A--) {
    if (!v1[A].size()) continue;
    for (int B = 0; B < v1[A].size(); B++) {
      if (s1.empty()) {
        s1.push(v1[A][B]);
      } else {
        int t = s1.top();
        if (t < v1[A][B]) {
          s1.push(v1[A][B]);
        }
      }
    }
  }
  ans = "";
  while (!s1.empty()) {
    int t = s1.top();
    s1.pop();
    ans += x[t];
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
  return 0;
}
