Inputs may be upper or lower case, or a mix. Please separate compounds with commas, and elements with spaces. You may type a number immediately after an element to indicate more atoms, as in 'H2 O'. This version cannot parse elements that run together without spaces. Also, this version is not aware of electrovalency and will not balance the charge in your reaction.
First we parse user input from the Precursors and Results fields to produce composite tree structures, each being a list of compounds, which are in turn lists of elements. We set the molar quantity of the first result compound to unity, then obtain the molar quantity for each precursor compound according to the amount of each first element present in the first result. Then we set the molar quantities of the remaining results according to how much of each first element is present in the precursors. Finally, we tally up all input elements, subtract the output elements, and produce a list of what is excess or missing.