#include <bits/stdc++.h>
using namespace std;
pair<int, int> find(int begin, int end, string str) {
  int k = 27, size = 0;
  char h;
  int l = 0;
  for (int i = begin; i < end; i++) {
    if (('z' - str[i]) < k) {
      k = 'z' - str[i];
      size = i;
      h = str[i];
      l = 1;
    } else if ('z' - str[i] == k) {
      size = i;
      l++;
    }
  }
  return make_pair(size, l);
}
int main() {
  string str;
  cin >> str;
  pair<int, int> h = find(0, str.size(), str);
  for (int i = 1; i <= h.second; i++) cout << str[h.first];
  int k = h.first + 1;
  while (k < str.size()) {
    h = find(k, str.size(), str);
    for (int i = 1; i <= h.second; i++) cout << str[h.first];
    k = h.first + 1;
  }
  return 0;
}
