Program to name a given hydrocarbon
The program takes input in the following format:
C represents a carbon atom
'-' Represents a single bond between 2 carbon atoms
'=' Represents a double bond
'#' Represents a triple bond
Brackets represent a branch on the given carbon atom
Hydrogen atoms should not be mentioned in input. Also, it is assumed that the first carbon atom (which is added automatically and should not be mentioned in the input) is a part of the longest chain.
The program finds the longest chain of carbon atoms, and provides a suitable name for the hydrocarbon, based on IUPAC naming conventions.
Sample input:
C-C(C)-C represents 2-methyl butane