well calculate the force on the charge at a distance x from the first ring at whose centre it was place
this can be done by considering a small charge dq on both the rings respectively then finding their force and then integrating them
now this will give force F in terms of x
find ∫Fdx
that will give u the work done