Problem 30 in Ruby.
Minor problem 25 formatting change.