Added a solution for Problem 7