n = list(input()) for i in range(len(n)-1): j = max(range(i+1, len(n))[::-1], key=lambda x: n[x]) if n[j] < n[i]: continue n[i], n[j] = n[j], n[i] break print(''.join(n))