#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> s; ll L = s.size(); vector A; A.push_back(s); FOR(i, 0, L){ FOR(j, i+1, L){ auto t = s; swap(t[i], t[j]); A.push_back(t); } } sort(ALL(A)); p(A.back()); return 0; }