import sequtils, strutils

let
  s1 = stdin.readLine
  ns = s1.toSeq.mapIt ($it).parseInt
var
  l, r: int
  s2 = s1

for i in 0 ..< s1.high:
  let max = (ns[i..^1]).max
  if max == ns[i]: continue
  l = i
  r = ns[i..^1].maxIndex.succ i
  swap(s2[l], s2[r])
  break

echo s2