A function to return the molecular weight of a string of a given chemical formula