Chemical Equation Balancer

For the final project of my AP Computer Science Principal course in high school, I decided that I would create a program that would balance chemical equations. For example, H2 + O2 -> H2O which would then be balanced as 2H2 + O2 -> 2H2O. The reason why I chose this idea was because I was taking AP Chemistry at the time and I thought it would be an incredible way of bridging the two classes. While it might seem kinda simple at first, when you start to add more complicated elements and compounds, the task was actually incredibly difficult. I remember spending hours on this program every single day and not making any progress on it. There became a point where I was looking back at my code and I had no idea what I was even trying to do with some blocks of code. I ended up turning in a buggy program that would only be able to solve the easy problems but I was still very proud of myself for what I was able to accomplish.