Problem 23 in Ruby....not my best work.