#include #include #include #include #include using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) int main(void){ string n; cin >> n; vector ans; ans.push_back(n); for (int i = 0; i < n.size(); ++i){ for (int j = i + 1; j < n.size(); ++j){ string tmp = n; swap(tmp[i], tmp[j]); ans.push_back(tmp); } } // rep(i, ans.size()) cout << ans[i] << endl; sort(ans.begin(), ans.end()); reverse(ans.begin(), ans.end()); // rep(i, ans.size()) cout << ans[i] << endl; cout << ans[0] << endl; return 0; }