Adding solution to Problem 7.