#P7674. [COCI 2013/2014 #5] EKSPLOZIJA
[COCI 2013/2014 #5] EKSPLOZIJA
Description
Given a string and a target string, find all occurrences of the target string in the given string and delete them.
Concatenate the remaining small pieces in their original order, and then keep performing this operation on the remaining string until no more occurrences of the target string appear.
Print the remaining string. If nothing remains, output FRULA.
Input Format
The first line contains a string, which is the original string.
The second line contains a string, which is the target string.
Output Format
One line containing a string, which is the remaining string.
mirkovC4nizCC44
C4
mirkovniz
12ab112ab2ab
12ab
FRULA
Hint
[Sample Explanation #1]
After the first deletion, the original string becomes mirkov**nizC**4 (* indicates deleted characters), i.e. mirkovnizC4.
After the second deletion, the string becomes mirkovniz**, i.e. mirkovniz.
[Sample Explanation #2]
After the first deletion, the original string becomes ****1****2ab (* indicates deleted characters), i.e. 12ab.
After the second deletion, the string becomes ****. Therefore output FRULA.
[Constraints]
For of the testdata, the original string length .
For of the testdata, the original string length , the target string length . All strings consist of uppercase letters, lowercase letters, and digits . It is guaranteed that there are no repeated characters in the target string.
[Notes]
The score of this problem follows the original COCI setting, with a full score of .
Translated from COCI2013_2014 CONTEST #5 T3 EKSPLOZIJA.
Translated by ChatGPT 5
京公网安备 11011102002149号