#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  for (int l = 0; l < s.size(); l++) {
    char maxx = s[l];
    int countt = 0;
    for (int i = l; i < s.size(); i++) {
      if (s[i] > maxx) {
        l = i;
        maxx = s[i];
        countt = 0;
      }
      if (s[i] == maxx) {
        countt++;
        l = i;
      }
    }
    for (int w = 0; w < countt; w++) cout << maxx;
  }
}
