Cenzura
Censorship is suppression of free speech common to authoritarian regimes, but not uncommon in democratic ones. Mirko was hired by the secret service and his very first assignment involved censorship. Given a text T he is required to remove all occurrences of the word A, using the following simple algorithm:
1. If A does not appear in T, end the algorithm.
2. Find the first occurrence of A in T and remove it.
3. If A does not appear in T, end the algorithm.
4. Find the last occurrence of A in T and remove it.
5. Go to step 1.
Help Mirko perform his task quickly so that he can continue fantasising about actual spy work.
The second line contains a string of at most 300 000 lowercase letters, the text T.
ne
lukanevolisarmuOutput:
lukavolisarmuaba
ababacccababa Output:
bacccab banana
babananananadeda Output:
dedaSubmit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.