CENZURA | 프로그래밍의 벗 PivotOJ
PivotOJ

CENZURA

시간 제한: 1500ms메모리 제한: 128MB출처: CHC 2009 National Competition #1 - SeniorsBOJ 3111

문제

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 first line contains a string of at most 25 lowercase letters, the word A. 

The first line contains a string of at most 300000 lowercase letters, the text T.

출력

Output the text after censorship. 

 

예제

예제 1

입력
ne
lukanevolisarmu
출력
lukavolisarmu

예제 2

입력
aba
ababacccababa
출력
bacccab

예제 3

입력
banana
babananananadeda
출력
deda
코드를 제출하려면 로그인하세요.