#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long prod = 1;
  while (b) {
    if (b & 1) prod = (prod * a);
    a = (a * a);
    b >>= 1;
  }
  return prod;
}
int main() {
  string s;
  cin >> s;
  map<int, vector<int>> m;
  for (int i = 0; i < s.size(); i++) {
    m[s[i] - 97].push_back(i);
  }
  int index = -1;
  for (int i = 25; i >= 0; i--) {
    if (m[i].size() >= 1) {
      auto it = upper_bound(m[i].begin(), m[i].end(), index);
      if (it == m[i].end()) continue;
      int num = m[i].size() - (it - m[i].begin());
      for (int j = 0; j < num; j++) cout << (char)(i + 97);
      index = m[i][m[i].size() - 1];
    }
  }
  return 0;
}
