s = raw_input() for d in range(1,len(s)): t = s[0:d] u = s[d:] if min(t) < max(u): p = s.find(min(t)) q = s.rfind(max(u)) l = list(s) l[p] = s[q] l[q] = s[p] s = ''.join(l) break print s