TopcoderArchive
SRM26 Jul 2001
SRM 17

Wordless

Problem statement, definition, constraints, and public examples.

Problem Statement

Class Name: Wordless
Method Name: stripWord
Parameters: String
Parameters: String

Ned has a strange disease that causes his body temperature to rise
uncontrollably until he fries whenever he reads an email containing the word
"word".  To combat this disease, he needs a filter to filer his email and
completely removes all instances of the string "word".  The filter should NOT
be case sensitive.  The filter should parse the input from left to right
removing all instances of "word".  If there are still instances of "word" after
one pass the filter should parse the string again (and again...) until no
instances remain.  That is, the result of filtering "awwowordrdordb" is "ab".

Help keep Ned from frying by implementing a class Wordless which contains a
method stripWord.  The method takes a String as a parameter and returns a
String that is the input String with all instances of "word" completely
removed, as specified above.

Here is the method signature (be sure your method is public):
String stripWord(String text);

Examples:
"ThisWORDisaWWORDordtest" should return "Thisisatest"
"wOrwOrwOrdDd" should return "".
"worworwor" should return "worworwor".
"normal text" should return "normal text".
"w o r d" should return "w o r d".

Definition

Class:
Wordless
Method:
stripWord
Parameters:
String
Returns:
String
Method signature:
String stripWord(String param0)
(be sure your method is public)

Constraints

    Examples

      No public sample cases were explicitly marked for this problem in the original data.

      Back to all problems