#include <bits/stdc++.h>
using namespace std;
pair<int, char> findM(string s) {
  int o = 0;
  char c = s[0];
  for (int i = 1; i < s.size(); i++) {
    if (s[i] > c) {
      c = s[i];
      o = i;
    }
  }
  pair<int, char> dro;
  dro.first = o;
  dro.second = c;
  return dro;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  double epsilon = 1e-7;
  string s, f;
  pair<int, char> fol;
  cin >> s;
  char max = s[0];
  for (int i = 0; i < s.size() - 1; i++) {
    if (max < s[i + 1]) {
      max = s[i + 1];
      s.erase(0, i + 1);
      i = -1;
      continue;
    }
    if (s[i] < s[i + 1]) {
      s.erase(i, 1);
      i--;
      if (i > 0) i--;
    }
  }
  cout << s;
  return 0;
}
