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".
|