Solution of Paramisoft's Problem, in Ruby.