Explanation
The relative speed of the two trains is the sum of their individual speeds, since they're moving in opposite directions: 62 km/h + 40 km/h = 102 km/h
Convert the relative speed from km/h to m/s: 102 km/h x (1000 m / 3600 s) = 28.33 m/s (approximately)
The time it takes for the trains to cross each other is given as 18 seconds.
The total distance covered by the trains during this time is the sum of their lengths. Let's call the length of the other train "x". Then, the total distance = 260 m + x
Since the relative speed is 28.33 m/s, the total distance can also be calculated as: Total distance = Relative speed x Time = 28.33 m/s x 18 s = 510 m
Equate the two expressions for total distance: 260 m + x = 510 m
Solve for x: x = 510 m - 260 m = 250 m