The way to do this is first to deal with the electrostatics of the problem i.e. figure out the nature of the repulsive force due to the charges. Based on the nature of this force we can then analyse the mechanics of the problem.

**Electrostatics**
Given the fact that this is a long rod we can assume that its length is much greater than $\displaystyle l$ or $\displaystyle r$ and so we can take it to be effectively infinite.

So assume the rod is of infinite length.
Note that the question states that $\displaystyle \lambda$ is the linear charge density which means it is the charge per unit length of the rod.

Consequently by symmetry arguments you should be able to see that the electrostatic repulsive force must be perpendicular to the length of the rod and so acting radially outwards.

To work out the force on $\displaystyle B$ I used Gauss's Theorem (otherwise known as a special case of Stoke's Theorem) with Maxwell's law of electromagnetism regarding divergence of electric field as it's the easiest way of working it out for me. Thus the electrostatic repulsive force, $\displaystyle F_E$ , is given by

$\displaystyle \color[rgb]{0,0,1}\boxed{F_E = \frac{Q \lambda }{2 \pi \epsilon_0 \rho}}$

where $\displaystyle \rho$ is the distance from the rod's center radially outwards to B.

However I know that you are only 16 and so this is perhaps too advanced a technique so alternatively the force can be found by integration of the force from Coulomb's law as follows. To do this we consider cylindrical slabs of the rod of length $\displaystyle \mathrm{d}z$ ($\displaystyle z$-axis along the axis of the rod) which carry charge $\displaystyle \lambda \mathrm{d}z$. For convenience we have the origin of the $\displaystyle z$-axis at the centre of the rod directly above $\displaystyle B$ at its initial position. As I stated earlier from symmetry arguments we only need to integrate over the component of the force which is perpendicular to the z-axis i.e. radially outwards from the rod. Hence the force due to the slab from Coulomb's law is

$\displaystyle dF_E = \frac{\rho}{\sqrt{\rho^2 +z^2}} \, \frac{Q \lambda }{4 \pi \epsilon_0 \left( \rho^2 +z^2 \right) } \, \mathrm{d}z$,

$\displaystyle \quad = \frac{Q \lambda \, \rho}{4 \pi \epsilon_0 \left( \rho^2 +z^2 \right)^{\frac{3}{2}} } \, \mathrm{d}z$,

and integrating we find

$\displaystyle F_E = \int_{-\infty}^{\infty} \frac{Q \lambda \, \rho}{4 \pi \epsilon_0 \left( \rho^2 +z^2 \right)^{\frac{3}{2}} } \, \mathrm{d}z$.

Using the substitution $\displaystyle \rho \tan \theta = z$ we have

$\displaystyle F_E = \frac{Q \lambda}{4 \pi \epsilon_0 \rho } \int_{-\pi/2}^{\pi/ 2} \cos \theta \, \mathrm{d}\theta = \frac{Q \lambda}{2 \pi \epsilon_0 \rho } $

as stated earlier.

**Mechanics**

Now we know that the electrostatic force is in the same direction as gravity so we can treat this in much the same way as we would if there was only a gravitational force.

Ordinarily if the particle was anchored to the rod then the velocity would be given by the kinetic energy of $\displaystyle B$ being equal to the potential energy lost. However, for this problem $\displaystyle B$ is not anchored and so the kinetic energy gained must be shared between the ring $\displaystyle A$ and particle $\displaystyle B$. To determine in what proportion the kinetic energy is shared between the two note that the net force acting on $\displaystyle B$ (due to gravity and electrostatic repulsion) only ever acts vertically down and so the system of $\displaystyle A$ and $\displaystyle B$ cannot have any change in their lateral (parallel to the rod) momentum. In other words the momentum of $\displaystyle A$ and $\displaystyle B$ parallel to the $\displaystyle z$-axis must be equal and opposite.

This means that if $\displaystyle A$ has speed $\displaystyle v_A$ and $\displaystyle B$ has lateral speed $\displaystyle v_B$ in the opposite direction then

$\displaystyle m v_A = 2 m v_B$

$\displaystyle \Rightarrow v_A = 2 v_B$

Now we need to compute the potential energy lost which is made up of gravitational PE of $\displaystyle 2mgl$ and electrostatic PE. The electrostatic PE is given by the work done,$\displaystyle W$ , to take $\displaystyle B$ from distance $\displaystyle l$ away from the rod to the initial point so

$\displaystyle W = \int_{r}^{l+r} F_E \, \mathrm{d} \rho$

$\displaystyle = \frac{Q \lambda}{2 \pi \epsilon_0 } \ln \left( \frac{l+r}{r} \right)$.

Hence the total KE must be

$\displaystyle \text{KE} = 2mgl + \frac{Q \lambda}{2 \pi \epsilon_0 } \ln \left( \frac{l+r}{r} \right)$

so if the speed of $\displaystyle B$ when the string is vertical is $\displaystyle v$ then we have

$\displaystyle \frac{1}{2} \, (2m) \, v^2 + \frac{1}{2} \, m \, (2v)^2 = 2mgl + \frac{Q \lambda}{2 \pi \epsilon_0 } \ln \left( \frac{l+r}{r} \right)$.

$\displaystyle

\Leftrightarrow 3m v^2 = 2mgl + \frac{Q \lambda}{2 \pi \epsilon_0 } \ln \left( \frac{l+r}{r} \right)$

so

$\displaystyle \color[rgb]{0,0,1} \boxed{v^2 = \frac{2}{3} g l + \frac{Q \lambda}{6 \pi \epsilon_0 m} \ln \left( \frac{l+r}{r} \right)}$.

Finally to find the tension in the string we simply use Newton II to relate the centripetal acceleration to the weight of $\displaystyle B$ and the tension, $\displaystyle T$, so

$\displaystyle 2m \frac{v^2}{l} = T - 2mg - F_E$

$\displaystyle \Leftrightarrow T = 2mg + 2m \frac{v^2}{l} + F_E (r+l)$

$\displaystyle = 2mg + \frac{4}{3} m g + \frac{Q \lambda}{3 \pi \epsilon_0 l} \ln \left( \frac{l+r}{r} \right) + \frac{Q \lambda}{2 \pi \epsilon_0 (r+l)}$,

so

$\displaystyle \color[rgb]{0,0,1} \boxed{ T = \frac{10}{3} m g + \frac{Q \lambda}{3 \pi \epsilon_0 l} \ln \left( \frac{l+r}{r} \right) + \frac{Q \lambda}{2 \pi \epsilon_0 (r+l)} }$.