ex2 solution