#include using namespace std; using ll = long long; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) int main() { string s; cin >> s; ll max_v = 0; REP(i, s.size()) REP(j, s.size()) { swap(s[i], s[j]); max_v = max(max_v, stoi(s)); swap(s[i], s[j]); } cout << max_v << endl; return 0; }