Total distance apart in the x direction is 14km. Total distance apart in the y direction is 18km. So the total distance between them is found using the Pythagorean Theorem....
Think about the two starting at 0,0 in the coordinate plane. Then say they start travelling, one towards positive y and the other towards negative y. They will end up at 7,0 and -7,0 after the first part. They then turn right, so the one who was travelling towards positive y will now be travelling towards negative x, and the one travelling towards negative y will not be travelling towards positive x. They will therefore finally end at 7,-9 and -7,9 after both parts.
Hence using pythagoras, the distance is: sqrt((7 + 7)^2 + (9 + 9)^2) = sqrt(196 + 324) = sqrt(520)