Hypothesis:
Let
$$ G \cong \left\langle a,b \mid abab^{-1}\right\rangle $$
$$ H \cong \left\langle c,d \mid c^2 d^2 \right\rangle $$
Let the function $f$ be defined as follows. First let $f(a) = cd$ and $f(b) = d^{-1}$. For all other elements $g$ of $G$, define $f(g)$ as follows:
$$ f(g) = f(a^{\alpha_1} b^{\beta_1} \cdot \ldots \cdot a^{\alpha_k}b^{\beta_k}) = f(a)^{\alpha_1} f(b)^{\beta_1} \cdot \ldots \cdot f(a)^{\alpha_k}f(b)^{\beta_k} $$
such that $a^{\alpha_1} b^{\beta_1} \cdot \ldots \cdot a^{\alpha_k}b^{\beta_k}$ is the fully reduced and unique word representation of $g$ in $G$.
Then $f$ is a well-defined mapping from $G$ to $H$.
Goal: Show that $f$ is an isomorphism. As my attempt below will reflect, I know how to show that $f$ is a surjective homomorphism, however I don't know how to show that it is an injection.
Attempt:
We need only check that $f(abab^{-1}) = e_H = c^2d^2$ in order for $f$ to be a homomorphism. To do this we have
$$ f(abab^{-1}) = f(a)f(b)f(b)f(b)^{-1} = (cd)(d^{-1})(cd)(d^{-1})^{-1} = c^2d^2 = e_H $$
as desired.
To show that $f$ is surjective, we note that
$$ f(ab) = f(a)f(b) = (cd)(d^{-1}) = c $$
$$ f(b^{-1}) = f(b)^{-1} = (d^{-1})^{-1} = d $$
so that if $h = c^{\alpha_1}d^{\beta_1} \cdot \ldots \cdot c^{\alpha_k}d^{\beta_k}$ we have that
$$ f\left((ab)^{\alpha_1}(b^{-1})^{\beta_1} \cdot \ldots \cdot (ab)^{\alpha_k}(b^{-1})^{\beta_k}\right) = c^{\alpha_1}d^{\beta_1} \cdot \ldots \cdot c^{\alpha_k}d^{\beta_k} = h $$
as desired.
Question: Why is $f$ injective?
Let's observe that an element in $G$ can be written as $a^nb^m$ for integers $n,m$. The relation $abab^{-1}=e\Rightarrow ba^{-1}=ab$ or $a^{-1}b=ba$. So given some word $$a^{k_1}b^{k_2}...a^{k_{r-1}}b^{k_r}$$ we can always move the $a^{k_j}$ to the left of the $b^{k_{j-1}}$. Then an arbitrary element in $G$ given by $a^nb^m$ mapped to $e$ by $f$ means $$f(a^nb^m) = f(a)^nf(b)^m = (cd)^n(d)^{-m} = e \Rightarrow n=0, m=0$$
Basically, $(cd)^n(d)^{-m}$ cannot be made to be the identity using $c^2d^2=e$ without $m=n=0$.
Therefore the kernel of $f$ is trivial.