P2379 Polynomial Calculation [Incorrect testdata]
Background
Xiao Ming has started middle school. He keeps making mistakes in polynomial calculations, so he turned to you, a programming enthusiast, to design a program to help him.
Description
Input several monomials or polynomials and compute the result.
Input Format
The expression includes +, -, \*, and letters (only the 26 lowercase letters a to z). A monomial has no surrounding brackets; a polynomial is enclosed in ( ) or [ ]. It is guaranteed that, within each multiplicative factor, monomials come before polynomials. The length does not exceed 255.
Output Format
Output the result of the expression, with each factor arranged in lexicographic order.
Explanation/Hint
A simple problem.
Translated by ChatGPT 5