Px,Py = gets.split.map(&:to_i) Qx,Qy = gets.split.map(&:to_i) X = Px - Qx Y = Py - Qy ans = X.abs + Y.abs puts ans