s = input()
i = 0
while i < len(s) - 1 and s[i] <= s[i + 1]:
    i += 1
ans_i = i
ans_j = i
ans_c = s[i]
for j in range(i + 1, len(s)):
    if s[j] == ans_c:
        ans_j = j
    elif s[j] < ans_c:
        ans_c = s[j]
        ans_j = j
        while ans_i > 0 and s[ans_i - 1] > ans_c:
            ans_i -= 1
if ans_i != ans_j:
    s = s[:ans_i] + s[ans_j] + s[ans_i + 1:ans_j] + s[ans_i] + s[ans_j + 1:]
print(s)

