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

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -