add a solution to the second problem of exam2