regex - Equation Expansion -
i've requirement i've simplify equation.
i've input like,
a + b *((c+d)(e+f))+x
and i've simplify equation a + bce + bcf + bde + bdf + x
make note that, there no numerical values assigned. i've simplify string equation , result in form of equation variables shown above.
currently, made stack kind of structure keep pushing in every character until encounter "+". once do, dump variables bottom top , remove elements stack until previous opening bracket ( on stack. until closing bracket @ remove until opening bracket previous 1 got closed.
however, trouble arises when i've (a+b)(e+f)
. unable come logic that. clueless on how i'll handling redundant brackets, ((a+b))
can on issue?
Comments
Post a Comment