Solved problem 26, with tests