#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main(){ ll max1 = 0, c1 = -1, c2 = -1; string s; cin >> s; vector l(s.size()); for (int i = 0; i < s.size(); i++) l[i] = (int) s[i]; sort(l.begin(), l.end(), greater()); for (int i = 0; i < s.size(); i++){ if (c1 < 0 && s[i] != l[i]) c1 = i; if (c1 >= 0 && s[i] == l[c1]){ c2 = i; } } swap(s[c1], s[c2]); cout << s << endl; }