A second degree polynomial ax^2 + bx + c can sometimes be
factored into two first degree polynomials with integer coefficients.
We want to produce the factorization as a string in the following
format:
(<coef>x<sign><num>)(<opneg><coef>x<sign><num>)
where
'(' ')' and 'x' are literal
<coef> is either empty or is a positive integer greater than 1.
<num> is a positive integer
<sign> is a sign character, either '+' or '-'
<opneg> is an optional '-' character
Neither <coef> nor <num> can be expressed with leading zeroes.
Given a, b, and c, return the factorization as a String. If no factorization
is possible, return the 4 uppercase letters "NONE". If more than one
factorization is possible, choose the one with the largest
coefficient of x in the first factor. If more than one is still possible,
choose the one whose first factor is bigger when evaluated at x=0.
|