#include <bits/stdc++.h>
using namespace std;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
inline int gcd(int a, int b) {
  if (a % b)
    return gcd(b, a % b);
  else
    return b;
}
inline int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
inline int And(int mask, int bit) { return mask & (1 << bit); }
inline int Or(int mask, int bit) { return mask | (1 << bit); }
inline int Xor(int mask, int bit) { return mask & (~(1 << bit)); }
char s[100010];
int n, p, mark[100010], x;
string ans;
int main() {
  gets(s);
  n = strlen(s);
  char ch = 'a';
  for (int i = 0; i < 26; i++) mark[i] = 0;
  for (int i = 0; i < n; i++) {
    mark[s[i] - 'a'] = 1;
    if (s[i] > ch) ch = s[i];
  }
  ans = "";
  x = 0;
  for (int j = 25; j >= 0; j--) {
    if (mark[j]) {
      p = x;
      ch = j + 'a';
      for (int i = p; i < n; i++) {
        if (ch == s[i]) {
          ans += ch;
          x = i;
        }
      }
    }
  }
  cout << ans << endl;
}
