Hello

I want to check whether a term was expanded correctly.

For example: \( (x+1)^2 \) should be written as \( x^2+2x+1 \).

I would like to have an answer like \(x^2+x+x+1 \) rated incorrect. There should be as few summands as possible.

Analogously when factoring a term, e.g. \( 2x^2-2 \) should be written as \( 2(x-1)(x+1) \).

A term with fewer factors should be evaluated as incorrect. There should be as many factors as possible.

How do I do that?