n = gets.strip mi = 0 max = n[0].to_i n.length.times do |i| t = n[i].to_i if t >= max max = t mi = i end end n[0], n[mi] = n[mi], n[0] puts n