As a consequence, several nuclear warheads that he has designed have detonated prematurely, wiping out five major cities and a couple of rain forests. Write a program to perform such multiplications and save the world. The file of input data will contain pairs of lines, none longer than 80 characters. Stop your program when no more input is available. Each input line contains a polynomial written without spaces and without any explicit exponentiation operator.
Exponents are positive non-zero unsigned integers.
Coefficients are also integers, but may be negative. Both exponents and coefficients are less than or equal to 100 in magnitude. Your program must multiply each pair of polynomials in the input and print each product on a pair of lines, the first line containing all the exponents, suitably positioned with respect to the rest of the information, which is in the line below. See the representation above. Factors of similar terms must be combined into a single term.