problem 85 in Ruby