n = list(map(int, input())) now_max_i = len(n)-1 for i in range(len(n)-2,-1,-1): if n[now_max_i] < n[i]: now_max_i = i n[now_max_i],n[0] = n[0], n[now_max_i] print("".join(map(str, n)))