A solution to Ruby Quiz #27:  http://rubyquiz.com/quiz27.html