So to create a CFG where the number of 0s and 1s are the same, I have:
$$ S \rightarrow SS \ | \ 0S1 \ | \ 1S0 \ | \ \epsilon $$
However, I don't know how to inject one single 2 to create the CFG that the number of 0s is the same as the number of 1s and there is exactly one 2. Any help is appreciated! Thanks!
$$S \rightarrow ST \mid TS \mid2T\mid 0S1 \mid 1S0 \\T\rightarrow TT\mid0T1\mid 1T0\mid\epsilon$$