Solution (source code)

= Solution

Let $E$ record whether the second stage erased the symbol, and write its output as $Z$. The erasure marker is outside the original output alphabet, so $E$ is determined by $Z$. <Independence> makes $E$ independent of both $X$ and the first output $Y$. The <chain rule for mutual information> therefore gives
$$
I(X;Z)=I(X;E,Z)=I(X;E)+I(X;Z\mid E)
=(1-p)I(X;Y).
$$
The erased branch gives zero information because its output is constant; the unerased branch has exactly the original joint input-output law. Maximizing over the same input distributions gives
$$
\boxed{C_{\rm composite}=(1-p)C}.
$$
This includes $p=0$ and $p=1$. It is the <capacity after independent output erasure>; input-dependent erasure would not justify the <independence> step.