#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int n = s.length(); string t = s; REP (i, n) REP (j, n) { swap(s[i], s[j]); t = max(t, s); swap(s[i], s[j]); } cout << t << endl; return 0; }