#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[1000000], ch;
  long long s = 0, l = 1, max = 0, n = 0, r = 0;
  while (cin >> ch) {
    l = l + 1;
    a[l] = ch;
  }
  n = l;
  l = 1;
  while (l <= n) {
    max = 0;
    s = 0;
    for (int i = l; i <= n; i++) {
      if (max < a[i]) {
        max = a[i];
        s = 0;
      }
      if (max == a[i]) {
        ch = a[i];
        s++;
        r = i;
      };
    }
    for (int i = 1; i <= s; i++) {
      cout << ch;
    }
    l = r + 1;
  }
  return (0);
}
