13 lines
218 B
Ruby
13 lines
218 B
Ruby
total = 0
|
|
|
|
while(true) do
|
|
line = gets
|
|
if line == nil then break end
|
|
numbers = line.split(' ').map do |number| number.to_i end
|
|
top = numbers.max
|
|
bottom = numbers.min
|
|
total += (top - bottom)
|
|
end
|
|
|
|
puts(total)
|