A microscopic theory of the double-charge-exchange reaction of pions on three- and four-particle nuclei using the hyperspherical formalism is developed. In this approach, the wave functions of the initial and final nuclear states represent the eigenfunctions of the same hamiltonian and they are obtained using the same NN potentials. Non-linear differential equations for three and four particles in the continuum spectrum are obtained. The solution of these equations enables one to determine the wave functions, the asymptotic behaviour of which corresponds to the scattered wave. The meson current and two-step mechanisms of double-charge-exchange reactions are considered. The differential and total cross sections are calculated using various NN potentials. It is shown that the cross section is very sensitive to the form of the NN potential. The interaction between all nucleons in the final states is very significant and changes the reaction cross section both qualitatively and quantitatively. A good convergence of the reaction cross section in the hypermoments of both initial and final states is demonstrated. The experimental data are described satisfactorily.