Let $G$ and $H$ be two abelian finite groups such that $\ell(G) = \ell(H)$ (Where $\ell$ denotes the length of their composition series). Suppose that $|H|$ and $|G|$ have the same prime divisors and conclude $|G| = |H|$.
My approach: Since both groups are abelian, all of their subgroups are abelian, then their composition factors are simple abelian groups, that is $\mathbb{Z}/p\mathbb{Z}$. Also, it's easy to show that $|G|$ will be the product of the composition factors of its composition series, i.e
If i have a composition series for $G$ as: $$ \{1_G\} = G_0 \trianglelefteq G_1 \trianglelefteq ... \trianglelefteq G_k=G $$ Then: $$ |G| = \prod_{i\geq 0}^{k-1}\big|G_{i+1}/G_i\big| $$ How to use the divisors fact to conclude? thanks.