Sketch for a proof of Theorem A [see this answer]
Definition: For an abelian finte $p$-group $G$ define
$$
\Omega_i(G) = \{x\in G\mid x^{p^i}=1\}.
$$
The following properties hold true:
- $\Omega_i(G)\subseteq\Omega_{i+1}(G)$.
- $\Omega_i(G)$ is characteristic.
- $\Omega_{i+1}(G)/\Omega_i(G) = \Omega_1(G/\Omega_i(G))$.
- $G=\Omega_1(G)\iff G$ is elementary abelian.
- If $G=\langle c\rangle$ then $|\Omega_{i+1}(G)/\Omega_i(G)|\le p$, with equality attained if, and only if, $\text{ord}(c)\ge p^{i+1}$.
Part (5) follows from part (3) in the case $G$ cyclic.
Theorem. [Kurtzweil & Stellmacher (2.1.9)]
Let $G$ be a direct product
$$
G = A_1 \times \cdots \times A_n \tag{*}
$$
of nontrivial cyclic $p$-groups. Define
$$
p^{n_i} = |\Omega_i(G)/\Omega_{i-1}(G)|.
$$
Then $n_i - n_{i+1}$ is the number of factors of order $p^i$ in $(*)$.
Proof. (Sketch)
For details use the properties above.
Step a. $\Omega_i(G) = \Omega_i(A_1)\times\cdots\times\Omega_i(A_n)$.
Step b. $\Omega_i(A_j) =\Omega_i(G)\cap A_j$.
Step c. $G/\Omega_i(G) \cong A_1/\Omega_i(A_1)\times\cdots\times A_n/\Omega_i(A_n)$.
Step d.
\begin{align*}
\Omega_{i+1}(G)/\Omega_i(G) &= \Omega_1(G/\Omega_i(G))
&&\text{; prop. 3.}\\
&= \Omega_{i+1}(A_1)/\Omega_i(A_1)\times\cdots\times
\Omega_{i+1}(A_n)/\Omega_i(A_n),
\end{align*}
Step e.
\begin{align*}
n_{i+1} &= \{j\mid \Omega_i(A_j)\ne\Omega_{i+1}(A_j)\}\\
&= |\{j\mid|A_j|\ge p^{i+1}\}| &&\text{; prop. 5.}
\end{align*}
$\Box$
Lemma. $A\leqslant G\implies
\Omega_{i+1}(A)/\Omega_i(A)\leqslant\Omega_{i+1}(G)/\Omega_i(G)$.
Proof. The inclusion $A\to G$ induces inclusions $\Omega_j(A)\to\Omega_j(G)$. In particular we have a morphism
$$
\Omega_{i+1}(A)/\Omega_i(A)\to\Omega_{i+1}(G)/\Omega_i(G),
$$
which is mono because $\Omega_i(A) = \Omega_{i+1}(A)\cap\Omega_i(G)$.
$\Box$
Theorem A [Kurzweil & Stellmacher. Exercise 2.1.7]
If $A$ is a subgroup of $G$, then $A$ is isomorphic to a quotient of $G$.
Proof.
Without loss of generality we may assume that $G$ is a $p$-group. We can further assume that
$$
G=(C_{p^{e_1}})^{r_1}\oplus\cdots
\oplus(C_{p^{e_i}})^{r_i}\oplus\cdots\oplus(C_{p^{e_n}})^{r_n},
$$
where the $e_1>\cdots>e_n\ge1$ and $r_i>0$ for all $i$. Similarly, we can pick an isomorphism
$$
A\cong(C_{p^{d_1}})^{s_1}\oplus\cdots\oplus(C_{p^{d_m}})^{s_m},
$$
with $d_1>\cdots>d_m\ge1$ and $s_j>0$ for all $j$.
From the Lemma and the Theorem above we deduce that there must be $s_1$ factors of $G$ with order $\ge p^{d_1}$, $s_2$ of order $\ge p^{d_2}$ etc. In particular, $d_1\le e_1$ (otherwise, there would be none). More precisely, if $i$ is the maximum index satisfying $d_1\le e_i$, then we must have $r_1+\cdots+r_i\ge s_1$. Thus, we can sum the quotient projections
\begin{align*}
\varphi_j\colon C_{p^{e_j}}&\to C_{p^{d_1}}
\end{align*}
to obtain the epimorphism
\begin{align*}
\varphi=\bigoplus_{j=1}^i\varphi_j\colon
(C_{p^{e_1}})^{r'_1}\oplus\cdots
\oplus(C_{p^{e_i}})^{r'_i}
&\to(C_{p^{d_1}})^{s_1},
\end{align*}
where $0\le r'_i\le r_i$ are integers that satisfy $r'_1+\cdots+r'_i=s_1$.
Now, among the remaining factors of $G$, there must be $s_2$ of them with order at least $p^{d_2}$. Thus, we can apply the same argument and repeat it until we exhaust the $m$ summands of $A$. In the end, we will be able to map $s_1+\cdots+s_m$ factors of $G$ onto the decomposition of $A$. The final epimorphism would then consist of this one, plus the mapping of any remaining factors to $0$.
$\Box$