For example, AB + AB' = A
and ABC + ABC' = AB
. When the user enters AB
, how can I find the missing letter and give it the form it was before it was simplified? In fact, what we need to do is multiply the missing letter and the missing(not) letter with the current expression. For example, A * (B + B')
.
Other examples
ABC + A'C'
(B is missing) =>(A'C' * (B + B')) + ABC
ABCD + AD'
(B and C are missing) =>((AD' * (B+B')) * (C + C')) + ABCD
We assume that the user enters the letters in order. The output should be accordingly. First "A" then "B" then "C" then "D" and up to D at most. How can we solve this problem with python?