#include <bits/stdc++.h>
template <typename T>
T inline SQR(const T &a) {
  return a * a;
}
template <typename T>
T inline ABS(const T &a) {
  return a < 0 ? -a : a;
}
const double EPS = 1e-9;
inline int SGN(double a) {
  return ((a > EPS) ? (1) : ((a < -EPS) ? (-1) : (0)));
}
inline int CMP(double a, double b) { return SGN(a - b); }
using namespace std;
int segt[1 << 18];
string s;
void build(int node, int lo, int hi) {
  if (lo == hi) {
    segt[node] = lo;
  } else {
    int ls = (node << 1) + 1;
    int rs = ls + 1;
    int mid = (lo + hi) >> 1;
    build(ls, lo, mid);
    build(rs, mid + 1, hi);
    if (s[segt[rs]] > s[segt[ls]])
      segt[node] = segt[rs];
    else
      segt[node] = segt[ls];
  }
}
int from, to;
int qry(int node, int lo, int hi) {
  if (from <= lo && hi <= to) return segt[node];
  int ls = (node << 1) + 1;
  int rs = ls + 1;
  int mid = (lo + hi) >> 1;
  if (mid + 1 > to) return qry(ls, lo, mid);
  if (mid < from) return qry(rs, mid + 1, hi);
  int a = qry(ls, lo, mid);
  int b = qry(rs, mid + 1, hi);
  if (s[b] > s[a]) return b;
  return a;
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin >> s;
  from = 0, to = int((s).size()) - 1;
  build(0, 0, to);
  while (from <= to) {
    int now = qry(0, 0, to);
    cout << s[now];
    from = now + 1;
  }
  cout << "\n";
  return 0;
}
