Java program to find the duplicate words in a string
In this program, we need to find out the duplicate words present in the string and display those words.
Example: big black bug bit a big black dog on his big black nose
To find the duplicate words from the string, we first split the string into words. We count the occurrence of each word in the string. If count is greater than 1, it implies that a word is duplicate in the string.
Duplicate words in a given string : big black