let i = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')[0] let x = parseInt(i) i = i.split('') for (let n = 0; n < i.length - 1; n++) { for (let m = n+1; m < i.length; m++) { let p = i.concat() let t = p[n] p[n] = p[m] p[m] = t let r = parseInt(p.join('')) if (x < r) x = r } } console.log(x)