Add solution for problem 6