How do I determine the relative length of an object based of travel time? Let me put this question into a problem:

Train A passes a milestone in 8 seconds before meeting train B. The two trains pass each other in  9 seconds. Then train B passes the same milestone in 12 seconds. Train A and B are traveling at equal speeds. Which of the following statements about the length of the trains is true?

The options are:


*

*Train A is twice as long as Train B

*Train B is twice as long as Train A

*They are of equal length

*B is 50% longer than A

*A is 50% longer than B


I would like to know how to determine the relative length of objects based on travel time. 
Thank You
 A: We know that the distance traveled at constant speed is equal to the rate of speed times the time.  Suppose train A is $a$ feet long, and train B is $b$ feet long, and that both trains travel at $f$ feet per second.  
It takes $8$ seconds for train A to pass a point.  In those $8$ seconds, the train traveled $8f$ feet, so $a=8f.$  Similarly, $b=12f$, and the the fourth choice is correct. 
B is $50\%$ longer than A.
I don't understand how they can say it takes $9$ seconds for the trains to pass one another.  Say the trains pass each other in $t$ seconds.  In that time each trains has advanced $ft$ feet, so the fronts of the two trains are $2ft$ feet apart.  But the distance between the fronts is equal to the sum of the length of the trains, which is $20f,$ and so $t=10.$ 
The time it takes for the two trains to pass one another is a red herring, as is the fact that train B passes the milestone $12$ seconds later.  I guess the problem author was just careless.    
A: The right answer is:


*

*B is 50% longer than A.


The information "The two trains pass each other in 9 seconds" is not important, it is superfluous.
Important is only the time during which trains pass the milestone:


*

*Train A passes the milestone in 8 seconds.

*Train B passes the milestone in 12 seconds.


So train B is 50% longer than train A.

Note:
From the passenger point of view the train is stationary, and the milestone is moving in opposite direction to meet the train. So the milestone moves along a longer train during longer time.
A: Let $L_A$ and $L_B$ be the lengths of trains $A$ and $B$, respectively. Let $w$ be the width of the mile stone and $v$ be the speed of the two trains. From the milestone equations we get $$v=\frac{L_A+w}{8}\implies 8v=L_A+w$$ $$v=\frac{L_B+w}{12}\implies 12v=L_B+w$$ $$2v=\frac{L_A+L_B}{9}\implies 18v=L_A+L_B$$
Subtracting the first equation from the second gives $$4v=L_B-L_A$$
Adding this to the third equation gives $$22v=2L_B\implies 11v=L_B$$ and substituting back into the previous equation gives us $L_A=7v$.
Therefore, $L_B=\frac{11}{7}L_A$.
