In chemistry, isomers are compounds that have the same number of atoms of each element, but that differ in the way these atoms are interconnected and arranged. In other words, isomers are compounds with the same molecular formula but different structural formulas (a compound is also an isomer of itself). Isomers usually have different chemical properties.

For example, ethanol (an alcohol) and dimethyl ether each consist of 6 hydrogen atoms, two carbon atoms, and an oxygen atom. Only the order of the chemical bonds is different. Both compounds share the same molecular formula ($$\text{C}_2\text{H}_6\text{O}$$) but have different structural formulas.

dimethyl ether vs ethanol

There are various standards that represent the structural formula of a compound as a string. You may assume that the atoms in such a string representation are symbolically named by an uppercase letter, followed by zero or more lowercase letters. The difference between uppercase and lowercase letters is important: the string PB represents one phosphorus atom (P) and one boron atom (B), while the string Pb represents one atom of lead. In addition, in between symbolic names of different atoms there might be other characters, such as in Na-OH or (CHHH)CO(CHHH). No other characters may occur in between the uppercase letter and the lowercase letters of the symbolic name of an atom.

Assignment

Example

>>> structural_formula1 = 'OCaOSeOO'
>>> structural_formula2 = 'HHCHHCHHCHHCHH'
>>> structural_formula3 = 'HHCHHHCCHHHCHH'

>>> molecular_formula(structural_formula1)
{'Ca': 1, 'Se': 1, 'O': 4}
>>> molecular_formula(structural_formula2)
{'H': 10, 'C': 4}
>>> molecular_formula(structural_formula3)
{'C': 4, 'H': 10}

>>> isomers(structural_formula1, structural_formula2)
False
>>> isomers(structural_formula1, structural_formula3)
False
>>> isomers(structural_formula2, structural_formula3)
True