#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[100008];
  cin >> s;
  int n = strlen(s);
  int h[1000] = {0};
  int max1 = 0;
  for (int i = 0; i < n; i++) {
    h[s[i]]++;
    int x = s[i];
    max1 = max(max1, x);
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == max1 && h[max1] > 0) {
      cout << s[i];
    } else if (h[max1] == 0) {
      int flag = 0;
      for (int i = max1 - 1; i >= 96; i--) {
        if (h[i] > 0) {
          max1 = i;
          flag = 1;
          break;
        }
      }
      if (flag == 0) {
        break;
      }
      if (s[i] == max1 && h[max1] > 0) {
        cout << s[i];
      }
    }
    if (max1 < 96) {
      break;
    }
    h[s[i]]--;
  }
  return 0;
}
