#include <bits/stdc++.h>
using namespace std;
char s[100005];
int inx[26][100005] = {0}, top[26] = {0};
int main() {
  memset(inx, 0, sizeof(inx));
  memset(top, 0, sizeof(top));
  scanf("%s", s);
  int len = strlen(s), cnt = 0;
  for (int i = 0; i < len; i++) {
    int t = s[i] - 'a';
    inx[t][top[t]++] = i;
  }
  for (int i = 25; i >= 0; i--) {
    if (i == 25)
      for (int j = 0; j < top[i]; j++) {
        putchar(i + 'a');
        cnt = inx[i][j];
      }
    else if (top[i]) {
      int v = cnt;
      int l = 0, r = top[i];
      while (l < r) {
        int m = (l + r) / 2;
        if (inx[i][m] >= v)
          r = m;
        else
          l = m + 1;
      }
      while (l < top[i]) {
        putchar(i + 'a');
        cnt = inx[i][l++];
      }
    }
  }
  puts("");
  return 0;
}
