my solution of problem 8