problem 100 in Ruby