Adding solution to problem 25