  The calculation of inclusive spectra of pions produced in $pp$ and $AA$
collisions as a function of rapidity $y$ is presented within the
self-similarity approach. It is shown that at not large rapidities $y$ one can
obtain the analytical form of the self-similarity function $\Pi(y,p_t)$
dependent of $y$ and hadron transverse momentum $p_t$. A satisfactory
description of data on the rapidity spectra at $|y|\leq$ 0.3 is illustrated
within a good agreement. The universal energy dependence of these spectra is
also shown.
