use relative velocity ur soln size gets reduced.... k see sit on train B say moving wit a speed of 40km/s.... so the train B is nw at rest kk..... nw train A dosnt move wit a speed of 50 bt wit a speed of 50+40= 90km/hr.... nw do the same exercise for their accelerations....k... nw use simple kinematics to gt the answer the asnwer comes out to be...3.856 secs.....
IF U LIKE IT THEN PLZZZ RATE ME....!!!