problem 89 in Ruby
problem 62 in Ruby