Parse a chemical formula to get a count of each element in a compound