#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
long long int min(long long int a, long long int b) {
  if (a < b) return a;
  return b;
}
string sing(char x) {
  string s(1, x);
  return s;
}
bool cmpDec(long long int a, long long int b) {
  if (a >= b) return true;
  return false;
}
void print1D(long long int a[], long long int n) {
  for (long long int i = 0; i < n; i++) cout << a[i] << " ";
  cout << "\n";
}
void print2D(long long int **dp, long long int n, long long int m) {
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) cout << dp[i][j] << " ";
    cout << "\n";
  }
}
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
typedef struct lms {
  char c;
  int idx;
} lms;
bool cmpLMS(lms x, lms y) {
  if (x.c > y.c)
    return true;
  else if (x.c < y.c)
    return false;
  else {
    if (x.idx < y.idx)
      return true;
    else
      return false;
  }
}
int main() {
  string s;
  cin >> s;
  lms a[s.length()];
  for (long long int i = 0; i < s.length(); i++) {
    a[i].idx = i;
    a[i].c = s[i];
  }
  sort(a, a + s.length(), cmpLMS);
  string ans;
  ans.append(sing(a[0].c));
  int prev = a[0].idx;
  for (long long int i = 1; i < s.length(); i++) {
    if (a[i].idx >= prev) {
      ans.append(sing(a[i].c));
      prev = a[i].idx;
    }
  }
  cout << ans << "\n";
}
