add problem 4 ruby solution.