Question: I'm making a program in java that asks the user for a passage and then a word which needs to be cencored. But the word

I'm making a program in java that asks the user for a passage and then a word which needs to be cencored. But the word should be followe by a space (" ") in order to get censored - otherwise it shouldn't be censored if it's the word is getting repeated in another word. Please write a code that will find that the word is a single word and hence not included in another word and though will censr it with stars(*).

Example:

An Uncensored Passage:

How much wood would a woodchuck chuck if a woodchuck could chuck wood ?

The same passage, but Censored with the keyword wood :

How much XXXX would a woodchuck chuck if a woodchuck could chuck XXXX ?

RULES:

Words may be censored if they are surrounded by whitespace

- Words may be at the beginning and end of the String

- Words may be followed by a period, comma, question mark or exclamation point

- (.,?!)

- This is only true if these characters come after the Word! - Words that are part of a larger word should not be censored.

- (i.e. wood and woodchuck from the example above)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!