Charge on two spheres will be equally divided on two sphere each times on touching.
When R is kept in contact with R, charge q is equally distributed between P and R.
Charge on p = q/2
Charge on R = q/2
When R is kept in contact with Q, total charge will again be equally distributed.
Initial force of repulsion between P and Q
Final force of repulsion between P and Q