#include <bits/stdc++.h>
using namespace std;
void solve(string a) {
  int n = a.length();
  if (n > 0) {
    int itemp = 0, max = 0;
    for (int i = 0; i < n; i++) {
      if (a[i] >= max) {
        max = a[i];
        itemp = i;
      }
    }
    for (int i = 0; i < n; i++) {
      if (a[i] == max) {
        cout << a[i];
      }
    }
    a.erase(0, itemp + 1);
    solve(a);
  }
}
int main() {
  string str;
  cin >> str;
  solve(str);
  return 0;
}
