Solve the simplify path problem in leetcode using stack.