According to the question , B's speed is more than A so it will take less time to cover the distance between X and Y.

Let distance between X and Z = x

So distance between Y and Z = 27 - x [ As B returns towards X and meet A at Z in that process ]

For meeting , time taken throughout must be same . Thus we have :

x / 5 = (27 + 27 - x) / 7

==> x / 5 = (54 - x) / 7

==> 7x = 270 - 5x

==> 12x = 270

==> x = 22.5

** Hence B) should be the correct option. **