#include <bits/stdc++.h>
using namespace std;
bool agm(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    if (a.second > b.second)
      return true;
    else
      return false;
  } else if (a.first < b.first)
    return true;
  else
    return false;
}
void solve(vector<int> &v, int sz) {
  int l = 0, idx, r = sz - 1;
  idx = max_element(v.begin(), v.end()) - v.begin();
  vector<pair<int, int> > vec;
  for (int i = idx; i <= r; i++) {
    vec.push_back(make_pair(v[i], i));
  }
  sort(vec.begin(), vec.end(), agm);
  reverse(vec.begin(), vec.end());
  l = vec[0].second;
  printf("%c", vec[0].first + 'a');
  for (int i = 0; i < vec.size(); i++) {
    if (vec[i].second > l) {
      l = vec[i].second;
      printf("%c", vec[i].first + 'a');
    }
  }
}
int main() {
  string s;
  cin >> s;
  int sz = s.length();
  vector<int> v(sz, 0);
  for (int i = 0; i < sz; i++) v[i] = s[i] - 'a';
  solve(v, sz);
  return 0;
}
