#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 10;
int n;
vector<string> a;
int ch[26];
bool used[26];
int pos[MAX_N][26];
int ans[MAX_N + 1], best[MAX_N + 1];
int dif_letters = 0, sum = 1111, word = 0, s = 0, w = 0;
int gcd(int a, int b) {
  while (a * b != 0)
    if (a < b)
      b = b % a;
    else
      a %= b;
  return a + b;
}
int main() {
  string s;
  cin >> s;
  char m = 'a';
  for (int i = 0; i < s.size(); ++i) m = max(s[i], m);
  int t = s.find(m);
  string res = "";
  res += s[t];
  for (int i = t + 1; i < s.size(); ++i) {
    int t = s.find(m, i);
    if (s[i] < m && t == -1) {
      while (1) {
        t = s.find(--m, i);
        if (t != -1 || m < 'a') break;
      }
    }
    if (t == -1) break;
    i = t;
    res += s[i];
  }
  cout << res;
}
