solve the simplify Path problem.