TopCoder problem "WordFilter" used in TCCC '01 Round 3 (Division I Level Two)



Problem Statement

    
This program takes as input two strings. The first of which is the search
string and the second is the buffer to search. The object of the program is to
remove all traces of the search string in the search buffer. The program will
perform the search starting at the beginning of the buffer and continue until
either the end of the buffer is reached or the search string is found. If the
search string is found, the string should be removed, and the search should
restart again from the beginning of the buffer. This process should repeat
until a full search through the buffer produces no more matches.

Requirements :

1. the search should be completely case-insensitive
       (ie "StRinG" should remove the phrase "sTrINg")
2. it should be a multi-pass filter
       (ie "string" should remove the phrase "strSTRINGing"

Here is the method signature :

public String strip(String str, String buf);

We will check to make sure the input to this problem is valid.

Here are some examples assuming the search string is "StRinG" :

"ccccstring ssssssssss" -> "cccc ssssssssss"
"ccccstrinstringgsssssssssss" -> "ccccsssssssssss"
"ccccstring stringssssssssss" -> "cccc ssssssssss"
 

Definition

    
Class:WordFilter
Method:strip
Parameters:String, String
Returns:String
Method signature:String strip(String param0, String param1)
(be sure your method is public)
    

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=47

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=2002&pm=47

Writer:

Unknown

Testers:

Problem categories:

String Manipulation