# Organic Compounds (rules)

can someone explain why in the fifth test the compound is valid?

CH2(2)CH0(1)CH1(2)CH0(1)CH3
(1) (1)
CH0 CH1(1)CH2(1)CH3
(3) (1)
CH1 CH3

The very first hydrocarbon has 5 bonds!?!?!?

Thatâ€™s 5 lines of input, not 5 bonds.

The very first carbon CH2(2) has 4 bonds. 2 bonds with 2 individual H and 2 bonds with the neighboring carbon CH0.

All carbons have 4 bonds â€¦ unless â€¦ we are going into detail that isnâ€™t necessary for solving this problem.

Doesnâ€™t the first bond on line 2 means that thereâ€™s a bond between the first HC in line 1 and the first HC in line 3? If itâ€™s so, the first C in line 1 would have 5 Hs (2 from itself, 2 from the next HC on line 1 and 1 from the first HC on line 3).

Sorry, canâ€™t insert an image to explain.

Thank you for the attention.

You might be ignoring empty spaces.

Thereâ€™s some empty space before the first (1) on line 2 for example. With that the bond ends up right where it belongs.

Bond #1 on line 2 is between CH0 on 1st line and CH0 on line 3.

One detail you might be confused by is the really stupid CH0 notation. It should have been C on its own and not CH0 or CFe0Mg0Cl0H0Al0Na0Se0Si0

So where you see H0 ignore it, it stands for zero hydrogen atoms.

1 Like

Oh, myâ€¦ You`re tottaly correct and I`m an idiot. I was stripping my input lines. I did it in the beginning, before undestanding that spaces are important for the problem.

Again, thank you very much for your help.

Mauro Crispim

Actually as I am getting all the numbers through a regex, the CH0 notation is really useful for not having a too complex regex. So I like it that way Furthermore, I think the â€śrealâ€ť notation is not the â€śrealâ€ť part of the problem here.

Hi all,
Iâ€™m having trouble passing the validator 8, â€śCyclic Hydrocarbon with substituentsâ€ť.
I get all the IDE tests right, and Iâ€™m clueless about what went wrong in that validator.