If (like in your example) the equations are separated by line breaks (or any other character will work) simply separate the equations maybe into custom objects then you can split each equations to numbers by splitting at every arithmetic symbols.
What I am suggesting is to phrase each line as an equation and find the missing bit by comparing both sides of the equal sign. You can find any one missing number each from any equation like this.
I have not provided any code example because you have not provided any code that you have currently tried out and also no specific language is specified. If you follow up with those I am ready to give a code sample.