This is a well known lemma that consistently appears in textbooks, either as a statement without proof, or as an exercise (see for example pp. 146 of Hatcher)
If $0 \stackrel{id}{\to} A \stackrel{f}{\to} B \stackrel{g}{\to} C\stackrel{h}{\to} 0$ is a short exact sequence of finitely generated abelian groups, then $\operatorname{rank} B = \operatorname{rank} A + \operatorname{rank} C$.
I've been trying to prove this unsuccessfully.
What do we know? $f$ is injective, $g$ is surjective, $\mathrm{Im} f = \mathrm{ker} g$, $\mathrm{Im} g = \mathrm{ker} h$, $C\simeq B/A$
So I start with a maximally linearly independent subset $\{ a_\alpha \}$ of $A$ such that the sum (with only finite non-zero entries) $\sum n_\alpha a_\alpha=0$ for $n_\alpha \in \mathbb{Z}$, implies that $n_\alpha=0$.
Where to go from here is a puzzle? Any hints would be appreciated