#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(), (a).end() int main() { cin.tie(nullptr); string N; cin >> N; int siz = N.size(); vector vec; vec.push_back(N); rep(i, 0, siz - 1) rep(j, i + 1, siz) { string tmp = N; swap(tmp[i], tmp[j]); vec.push_back(tmp); } sort(all(vec)); reverse(all(vec)); cout << vec[0] << '\n'; }