n = gets max = 0 n.length.times {|i| n.length.times {|j| n_ = n.clone n_[i] = n[j] n_[j] = n[i] max = [max, n_.to_i].max } } puts max