Solution (By Examveda Team)
$$\eqalign{
& {\text{Let the speed of first train be }} \cr
& {{\text{S}}_1}{\text{ km/hr and speed of second train}} \cr
& {\text{is }}{{\text{S}}_2}{\text{km/hr }} \cr
& {\text{As we know,}} \cr
& {\text{Time }} \cr
& {\text{ = }}\frac{{{\text{total distance}}}}{{{\text{relative speed in same/opposite direction}}}} \cr
& {\text{In the same direction}} \cr
& \Rightarrow {\text{27 sec = }}\frac{{\left( {100 + 95} \right)}}{{\left( {{\text{ }}{{\text{S}}_1} - {\text{ }}{{\text{S}}_2}} \right) \times \frac{5}{{18}}}} \cr
& \Rightarrow 27 = \frac{{195 \times 18}}{{\left( {{\text{ }}{{\text{S}}_1} - {\text{ }}{{\text{S}}_2}} \right) \times 5}} \cr
& \Rightarrow {\text{ }}{{\text{S}}_1} - {\text{ }}{{\text{S}}_2} = 26.......................(i) \cr
& {\text{In the opposite direction,}} \cr
& \Rightarrow 9 = \frac{{\left( {100 + 95} \right)}}{{\left( {{\text{ }}{{\text{S}}_1}{\text{ + }}{{\text{S}}_2}} \right) \times \frac{5}{{18}}}} \cr
& \Rightarrow 9 = \frac{{195 \times 18}}{{\left( {{\text{ }}{{\text{S}}_1}{\text{ + }}{{\text{S}}_2}} \right) \times 5}} \cr
& \Rightarrow {\text{ }}{{\text{S}}_1}{\text{ + }}{{\text{S}}_2} = 39 \times 2 \cr
& \Rightarrow {\text{ }}{{\text{S}}_1}{\text{ + }}{{\text{S}}_2} = 78 \cr
& {\text{From equation (i) and (ii)}} \cr
& \Rightarrow {\text{ }}{{\text{S}}_1} - {\text{ }}{{\text{S}}_2} = 26 \cr
& \Rightarrow {\text{ }}{{\text{S}}_1}{\text{ + }}{{\text{S}}_2} = 78 \cr
& \Rightarrow {\text{ }}{{\text{S}}_1} = \frac{{26 + 78}}{2} \cr
& \Rightarrow {\text{ }}{{\text{S}}_1} = \frac{{104}}{2} \cr
& \Rightarrow {\text{ }}{{\text{S}}_1}{\text{ = 52 km/hr and }} \cr
& \,\,\,\,\,\,\,\,\,\,{{\text{S}}_2}{\text{ = 26 km/hr}} \cr} $$
5/18 multiplied because of converting km/hr units of speed to m/s to equalise the unit given in the question.
How the 5/18 came?
Answer is 52mps,26mps