solve problem 6