added the solution of first problem