Solution for Ruby Quiz #39 - http://rubyquiz.com/quiz39.html