Factoring Polynomials Using Substitution