N = map(int, list(raw_input())) l, r = -1, -1 fl = False for i in xrange(len(N)): if not fl and N[i] == max(N[i:]): continue else: fl = True if fl: if l != -1 and N[i] == max(N[l+1:]): r = i if l == -1 and N[i] != max(N): l = i #print l, r ans = [] if l < r: for i in xrange(l): ans.append(N[i]) ans.append(N[r]) for i in xrange(l+1,r): ans.append(N[i]) ans.append(N[l]) for i in xrange(r+1, len(N)): ans.append(N[i]) else: ans = N ans = map(str, ans) print ''.join(ans)