Let $T \propto S^{x}r^{y}p^{z}$ By substituting the dimensions of $\lbrack T\rbrack = \lbrack T\rbrack$ $\lbrack S\rbrack = \left\lbrack MT^{- 2} \right\rbrack,\lbrack r\rbrack = \lbrack L\rbrack,\lbrack\rho\rbrack = \left\lbrack ML^{- 3} \right\rbrack$ and by comparing the power of both the sides $x = - 1/2,y = 3/2,z = 1/2$ so $\ T\ \propto \sqrt{\rho r^{3}/S\ } \Rightarrow T = k\sqrt{\frac{\rho r^{3}}{S}}$