problem nine in Ruby