#P7674. Repeated String Explosion

    ID: 20864 Type: Default 1000ms 256MiB

Repeated String Explosion

Repeated String Explosion

You are given a string S and a target string T. Your task is to remove every occurrence of T from S repeatedly until no occurrence of T remains. At each step, if T is found in the string, remove it and then concatenate the remaining parts in the original order. Continue this process until the target string does not appear in the string anymore.

If the final string becomes empty after all the removals, print FRULA.

Mathematically, if we denote the initial string by \(S\) and the target string by \(T\), then we repeatedly perform the operation:

[ S = S \setminus T ]

until \(T\) is no longer a substring of \(S\).

inputFormat

The input consists of two lines:

  1. The first line contains the string S (the original string).
  2. The second line contains the target string T.

outputFormat

Output the final string after performing all removals. If the final string is empty, output FRULA.

sample

mirkovC4nizCC44
C4
mirkovniz