Problem 29 in Ruby.
Problem 27 is in progress.