5.12 (Repeating ciphertexts). Let $\mathcal{E} = (E, D)$ be a cipher defined over $(\mathcal{K}, \mathcal{M}, \mathcal{C})$. Assume that there are at least two messages in $\mathcal{M}$, that all messages have the same length, and that we can efficiently generate messages in $\mathcal{M}$ uniformly at random. Show that if $\mathcal{E}$ is CPA secure, then it is infeasible for an adversary to make an encryptor generate the same ciphertext twice. The precise attack game is as follows. The challenger chooses $k \in \mathcal{K}$ at random and the adversary makes a series of queries; the $i$th query is a message $m_i$, to which the challenger responds with $c_i\overset{R}{\leftarrow} E(k, m_i)$. The adversary wins the game if any two $c_i$’s are the same. Show that if $\mathcal{E}$ is CPA secure, then every efficient adversary wins this game with negligible probability. In particular, show that the advantage of any adversary $A$ in winning the repeated-ciphertext attack game is at most $2\epsilon$, where $\epsilon$ is the advantage of an adversary $B$ (which is an elementary wrapper around $A$) that breaks the scheme’s CPA security.
I'm going to changing my research field from coding theory to cryptography. Here is a problem from the book "A Graduate Course in Applied Cryptography" that confused me for days.
This problem requires us to make a reduction from the CPA security to the "Repeated-ciphertext security". Actually I don't know: when the adversary $\mathcal A$ finds repeated ciphertext, how the elementary wrapper $\mathcal B$ would use it to gain its CPA-advantage over this probabilistic cipher. Could anyone help to give a reduction on it? Thank you.