Add solution of problem 5