#include <bits/stdc++.h>
using namespace std;
void init() {}
void solve() {}
struct Point {
  char s;
  int x;
} p[100009];
char s[100009];
vector<int> v[28];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    v[s[i] - 'a'].push_back(i);
  }
  int flag = -1;
  for (int i = 26; i >= 0; i--) {
    if (v[i].size() == 0) continue;
    if (flag == -1) {
      for (int j = 0; j < v[i].size(); j++) {
        putchar(char(i + 'a'));
        if (v[i][j] > flag) {
          flag = v[i][j];
        }
      }
    } else {
      int k = -1;
      for (int j = 0; j < v[i].size(); j++)
        if (v[i][j] > flag) {
          putchar(char(i + 'a'));
          if (v[i][j] > k) {
            k = v[i][j];
          }
        }
      if (k != -1) flag = k;
    }
  }
  puts("");
  return 0;
}
