Lets say thatV1= velocity of first train=50 ft/s
V2= Velocity of second train=30 ft/s
Then, the velocity of two trains moving in opposite directions is:
Vr= V1 + V2
From here we know that Vr= 50+30= 80 ft/s
Therefore, the distance is going to be 150ft
So the time taken= distance/ relative velocity
t=150/80
t=1.875 s
Hope this helped!