#include <bits/stdc++.h>
const int MAXN = 100100;
int st[20][MAXN];
char str[MAXN];
int n;
void SparseTable() {
  for (int i = 0; i < n; i++) st[0][i] = i;
  for (int j = 1; (1 << j) < n; j++)
    for (int i = 0; i + (1 << (j - 1)) < n; i++)
      st[j][i] = (str[st[j - 1][i]] >= str[st[j - 1][i + (1 << (j - 1))]]
                      ? st[j - 1][i]
                      : st[j - 1][i + (1 << (j - 1))]);
}
int get(int x, int y) {
  int k = int(log(double(y - x + 1)) / log(2.0));
  return (str[st[k][x]] >= str[st[k][y - (1 << k) + 1]]
              ? st[k][x]
              : st[k][y - (1 << k) + 1]);
}
int main() {
  scanf("%s", str);
  n = strlen(str);
  SparseTable();
  int p = 0;
  while (p != n) {
    p = get(p, n - 1);
    printf("%c", str[p]);
    p++;
  }
  printf("\n");
  return 0;
}
