Added the solution for stack4