#include <bits/stdc++.h>
using namespace std;
string s;
char m;
int cnt, lastIndex, n, start;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> s;
  n = s.size();
  m = s[0];
  cnt = 1;
  lastIndex = 0;
  start = 1;
  if (n == 1) {
    cout << m << '\n';
    return 0;
  }
  while (start < n) {
    for (int i = start; i < n; ++i) {
      if (s[i] == m) {
        cnt++;
        lastIndex = i;
      } else if (s[i] > m) {
        m = s[i];
        cnt = 1;
        lastIndex = i;
      }
    }
    for (int k = 0; k < cnt; ++k) {
      cout << m;
    }
    start = lastIndex + 1;
    cnt = 0;
    if (start < n) m = s[start];
  }
  cout << '\n';
}
