adds ruby solution for problem 5, needs refactoring