The physics
Two identical metal spheres touch. Then they carry the same charge. Each gets half the total, signs included.
qA′ = qB′ = (qA + qB) / 2
F = k qA qB / (K r²)
So the force changes with the product of the charges. It falls as 1/r². A medium divides it by K.
If the product changes sign, attraction turns into repulsion.