#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  while (cin >> s) {
    string s1;
    int i = 0;
    char ch;
    while (s[i]) {
      i++;
    }
    int k;
    int ct = 0;
    char max = s[i - 1];
    for (k = i - 1; k >= 0; --k) {
      if (s[k] >= max) {
        s1 += s[k];
        ct++;
        max = s[k];
      }
    }
    for (k = ct - 1; k >= 0; k--) printf("%c", s1[k]);
    printf("\n");
  }
  return 0;
}
