X34: wordEnds

Write a function in Java that implements the following logic: Given a string str and a non-empty word, return a string made of each character just before and just after every appearance of the word in str. Ignore cases where there is no character before or after the word, and a character may be included twice if it is between two words.

Your Answer:


Practice a different Java exercise


Your feedback will appear here when you check your answer.