#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 2005;
vector<long long> g[N];
vector<long long> ans;
long long n;
vector<bool> vis;
vector<long long> level;
void bfs(long long second) {
  queue<long long> q;
  q.push(second);
  vis[second] = true;
  level[second] = 1;
  while (q.size()) {
    second = q.front(), q.pop();
    for (long long v : g[second]) {
      if (!vis[v]) {
        vis[v] = true;
        level[v] = 1 + level[second];
        q.push(v);
      }
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string second, ans = "";
  cin >> second;
  long long lastind = -1;
  char ch = 'z';
  long long n = second.length();
  long long start = 0;
  while ((ch >= 'a')) {
    for (long long i = 0; i < n; i++) {
      if (ch == second[i] && i > lastind) {
        ans += ch;
        lastind = i;
      }
    }
    ch--;
  }
  cout << ans;
  return 0;
}
