problem 97 in Ruby