add problem 9 ruby solution.