#include <bits/stdc++.h>
int main() {
  char map[110000];
  while (~scanf("%s", map)) {
    int s = strlen(map);
    char si[110000] = "\n";
    int k = 0, xi = 0;
    if (s == 1)
      printf("%s\n", map);
    else
      while (1) {
        if (xi == s - 1) break;
        char x = 2;
        for (int i = 0; i < s; i++) {
          if (map[i] > x) {
            x = map[i];
          }
        }
        for (int i = 0; i < s; i++) {
          if (map[i] == x && i >= xi) {
            si[k++] = x;
            map[i] = 1;
            xi = i;
          }
          if (map[i] == x) {
            map[i] = 1;
          }
        }
      }
    printf("%s\n", si);
  }
  return 0;
}
