The solution of this problem becomes simple in the frame attached with one of the bodies. Let the body thrown straight up be 1 and the other body be 2, then for the body 1 in the frame of 2 from the kinematic equation for constant acceleration:
→r12=→r0(12)+→v0(12)t+12→w12t2
So, →r12=→v0(12)t, (because →w12=0 and →r0(12)=0)
or |→r12|=|→v0(12)|t (1)
But |→v01|=|→v02|=v0
So, from properties of triangle
v0(12)=√v20+v20−2v0v0cos(π2−θ0)
Hence, the sought distance |→r12|=v0√2(1−sinθ)t=22m