#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100100], b[100100];
  int letter[27] = {0}, index = 0, i = 0;
  char maxx = '0';
  for (i = 0; s[i - 1] != '\n'; i++) {
    scanf("%c", &s[i]);
  }
  int k = 0, counter = 0, index2 = 0, j = 0;
  while (true) {
    maxx = '0';
    int bol = 0;
    for (j = index; j < i - 1; j++) {
      if (s[j] >= maxx) {
        maxx = s[j];
        index2 = j;
      }
    }
    for (k = index; k < i - 1; k++) {
      if (s[k] == maxx) {
        cout << s[k];
      }
      bol = 1;
    }
    index = index2 + 1;
    if (bol == 0) break;
  }
  return 0;
}
