How do we represent a molecule in text form? A molecule, as a computer scientist I see it as a connected graph of atoms. A connected graph means that beginning at any atom, there is a path to any other atom in the graph. The interesting question is, how do we represent these as text? Specific questions are: 1) Is $\ce{H2O}$ different than $\ce{OH2}$? That is, does order matter, or what does order mean? 2) What does this mean $\ce{NH4NO3}$? Why do we write N two times? Is this the same thing $\ce{NNH4O3}$?