Problem 7 flatten