solution for ex5