./compile_yacc.sh matrix_calculator.l matrix_calculator.y
This chemical eq will be simplified to 2H2O2 -> 2H2O + O2
.
That is we won’t use subscript and ,instead, use the number directly.
The output will be pairs of element and number.
The listed element will be that of too much or too little in the equation.
The number is greater than zero, if the corresponding element is too much in left hand side.
The number is less than zero, if the corresponding element is too little in left hand side.
And the magnitude will be the amount of the difference.
If the difference is 0
in left hand and right hand side, the element don’t need to be listed.
And also you need to print the result pairs in lexicographic order of the listed element for our judge’s easiness.
- Input
CH3C6H5 + 3HNO3 -> CH3C6(NO2)2 + H2O
- Output
H 6
N 1
O 4
- Input
C2(2O) -> C2O2
- Output
Invalid format