X31: plusOut

Write a function in Java that implements the following logic: Given a string str and a non-empty word, return a version of the original string where all chars have been replaced by pluses (+), except for appearances of the word which are preserved unchanged.

Examples:

plusOut("12xy34", "xy") -> "++xy++"
plusOut("12xy34", "1") -> "1+++++"

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.