#include <bits/stdc++.h>
using namespace std;
long long int a[305105], b[100005];
long long int sa[100005], sb[100005];
vector<int> v, v1, temp;
long long int n, m, k, d, l, i, w, r, j, x, y, in1, in2, h, f,
    mn = INT_MAX, mx = 0, t, c, ans, q;
map<int, int> mp;
string z;
map<int, int>::iterator it;
map<int, int>::reverse_iterator rt;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string ans;
  char p;
  cin >> z;
  n = z.length();
  ans = z[n - 1];
  p = z[n - 1];
  for (i = n - 2; i >= 0; i--) {
    if (z[i] >= p) ans = z[i] + ans, p = z[i];
  }
  cout << ans;
}
