#include <bits/stdc++.h>
using namespace std;
long long min(long long x, long long y) { return (x < y) ? x : y; }
long long max(long long x, long long y) { return (x > y) ? x : y; }
const int N = 100009;
int x, y, n, m, e, i, u, w, mx, z, sum, l, r, best, cnt, g, j, k, t, ans;
int a[N];
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> s;
  mx = -1;
  n = s.size();
  for (i = 32; i >= 0; i--) {
    for (j = 0; j < n; j++) {
      if (s[j] == i + 'a' && j > mx) {
        cout << s[j];
        mx = j;
      }
    }
  }
  return 0;
}
