#include #include #include using namespace std; int main(){ string s,r; cin >> s; sort(s.begin(),s.end()); do { r = max(r,s); } while(next_permutation(s.begin(),s.end())); cout << r << endl; }