Question #1


Write a program that allows for the input of two Multivariate polynomials and produces the result of adding them and multiplying them.

Examples of multivariate polynomials:

xy2z + 31wx3y3z50 + w
v2 + s3 + 3wx3y3

Input

Assume ...

Here are two examples:

X Y^2 Z + 31 W X^3 Y^3 Z^50 + S^3
V^2 + S^3 + 3 W X^3 Y^3

Output

If the above examples were the polynomials input, the output will be:
(X Y^2 Z + 31 W X^3 Y^3 Z^50 + W) + (V^2 + S^3 + 3 W X^3 Y^3) =
X Y^2 Z + 31 W X^3 Y^3 Z^50 + 2 S^3 + V^2 + 3 W X^3 Y^3

(X Y^2 Z + 31 W X^3 Y^3 Z^50 + W) * (V^2 + S^3 + 3 W X^3 Y^3) =
X Y^2 Z V^2 + X Y^2 Z S^3 + 3W X^4 Y^5 Z + 31 W X^3 Y^3 Z^50 V^2 + 31 W X^3 Y^3 Z^50 S^3 + 93 W^2 X^6 Y^6 Z^50 + S^3 V^2 + S^6 + 3 S^3 W X^3 Y^3