Add Ruby solution to problem 5.