#include <bits/stdc++.h>   using namespace std;   void prepare() {}   void solve() {     string s;     cin >> s;     set<int> ss[26];     for (int i = 0; i < s.size(); ++i) ss[s[i] -  a ].insert(i);     int i = 25;     int cur = -1;     while (i != -1) {       if (ss[i].empty()) {         --i;         continue;       }       while (!ss[i].empty() && *ss[i].begin() < cur) ss[i].erase(ss[i].begin());       if (ss[i].empty()) {         --i;         continue;       }       for (int j = 0; j < ss[i].size(); ++j) printf( %c , i +  a );       cur = *(--ss[i].end());       --i;     }   }   int main() {     prepare();     solve();     return 0;   }   