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.
InputThe first line contains a string of at most 25 lowercase letters, the word A.
The second line contains a string of at most 300 000 lowercase letters, the text T.
The second line contains a string of at most 300 000 lowercase letters, the text T.
OutputOutput the text after censorship.
Input:
Output:
ne
lukanevolisarmuOutput:
lukavolisarmuInput:
Output:
aba
ababacccababa Output:
bacccab Input:
Output:
banana
babananananadeda Output:
dedaSubmit solution
Sign in to submit a solution.