Math New Drill : Level 2 SNJ00-0411-L2 Two trains passing each other

Two trains A and B are moving parallel in an opposite direction at a fixed speed respectively. 
Head of A and head of B passed each other exactly at P spot. 
6 seconds later tail end of A and head of B passed each other. 
Moreover 4 seconds later head of A and tail end of B passed each other at Q spot where it's 150 m away from P spot. 
Finally tail end of A and tail end of B passed each other at R spot where it's 78 m away from P spot to the direction where A is moving. 
Find the speed per second and the length of A and B respectively.



Answer
A:15 m/s, 162 m
B : 12 m/s, 270 m

Solution
The speed of A is 150 / 10 = 15 m/s. 
The speed of B is (150 - 78) / (16 - 10) = 12 m/s. 
Total distance where A and B moved is equivalent to the length of A in 6 seconds and the length of B in 10 seconds. 
Therefore the length of A is (15 + 12) × 6 = 162m and the length of B is (15 + 12) × 10 = 270m.