#include <bits/stdc++.h>
using namespace std;
int main() {
  int i;
  int j;
  char s[100010];
  char ans[100010];
  int ans_i = 0;
  scanf("%s", s);
  for (i = 0; s[i] != '\0'; i++) {
    if (ans_i == 0) {
      ans[ans_i++] = s[i];
    } else if (s[i] > ans[ans_i - 1]) {
      for (j = ans_i - 1; j >= 0; j--) {
        if (ans[j] >= s[i]) {
          break;
        }
      }
      ans[j + 1] = s[i];
      ans_i = j + 2;
    } else {
      ans[ans_i++] = s[i];
    }
  }
  ans[ans_i] = '\0';
  printf("%s\n", ans);
  return 0;
}
