Problem Given a language $L$ is context-free, must $\operatorname{alt}(L)$ is also context free? where $$\operatorname{alt}(L) = a_1a_2a_3 \ldots, \quad L = a_1b_1a_2b_2a_3b_3 \ldots$$
I couldn't find a counter example so I guess it must be CF also. But I couldn't find a way how to prove it correctly. Anyone could give me a hint on this? Thank you.
Hint: Create duplicates of all states in the PDA recognizing $L$, with the duplicates effectively keeping track of the parity of the index within a word. A duplicate should be accepting iff its original is accepting, and transitions should alternate between the two copies of the states to reflect the change in parity. Be careful on what gets pushed/popped from the stack on the transitions, there are some subtleties that must be dealt with.