How to count the number of elements of given order? I am trying to prove the following result.

Let $G$ and $G'$ be two finite abelian groups. Besides, they have the same number of elements of any given order. Prove that $G\cong G'$.

My attempt is by induction on $|G|\geq1$. The base step is obviously true. Now, let $a\in G$ have maximal order. Then $G=\langle a\rangle\oplus H$ for some $H\subset G$. By hypothesis, we can choose an element $a'\in G'$ of maximal order (equal to that of $a$), and therefore $G'=\langle a'\rangle\oplus H'$ for some $H'\subset G'$. Now, I need to show that $H$ and $H'$ have the same number of elements of any given order. If it is true, by induction, it follows that $H\cong H'$. Since $a$ and $a'$ have the same order, it follows that $\langle a\rangle\cong\langle a'\rangle$. Therefore, I can conclude that $G\cong G'$.
My question is: how to show that $H$ and $H'$ still have the same number of elements of any given order?
One of my thought:
It can be shown that $\langle a\rangle$ is a pure subgroup of $G$ and that $G/\langle a\rangle\cong H$. Therefore, it suffices to count $G/\langle a\rangle$. Since $\langle a\rangle$ is pure, for every $g+\langle a\rangle$, we can choose $z\in G$ such that $z+\langle a\rangle=g+\langle a\rangle$, and $ord(z)=ord(g+\langle a\rangle)$. But I still cannot move on based this fact.
Any help? (Maybe it is really a silly question, since it seems that it is really about basic group theory)
 A: I'd suggest leveraging the structure theory of finite abelian groups, which tells us any finite abelian group is determined by the number of primary factors it has of each order (which are invariants of the group). One can "work backwards" and read off the number of elements of a given prime power order in $G$, given its primary decomposition, and then reverse the direction to obtain the primary decomposition in terms of the numbers of elements of certain orders.
This idea I suppose could be applied to your $H\cong H'$ step in your argument. Let $f_G(n)$ be the number of elements of order $n$ in a group $G$. If $G=A\oplus H$ then we have the formula
$$f_G(n)=\sum_{{\rm lcm}(u,v)=n}f_A(u)f_H(v).$$
Perhaps you could use this to show $\forall n~f_G(n)=f_{G'}(n)~\Rightarrow~\forall d~ f_H(d)=f_{H'}(d)$.
A: I agree, with a previous comment, that restricting to $p$-groups first is a good idea. In fact note that knowing the orders of each element is equivalent to knowing, for all $n$, the size of kernel of multiplication by $n$. (why? The kernel of multiplication by $n$ is the disjoint union (over the divisors $d$ of $n$) of the elements of order $d$). I feel this should be a nicer computation. 
