Can you help me to write a java program to find the duplicate words and their number of occurrences in a string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you help me to write a java program to find the duplicate words and their number of occurrences in a string?

7th Jan 2018, 6:19 PM
Sreerag Murali
Sreerag Murali - avatar
4 Answers
+ 2
I also wanna know this....
7th Jan 2018, 7:55 PM
Rishabh
Rishabh - avatar
0
what is hashmap.. ? is any other method available?
7th Jan 2018, 6:29 PM
Sreerag Murali
Sreerag Murali - avatar
0
hashmaps are explained in the java course. you can also split the string into words and simply interate over your other words and save the number somewhere
7th Jan 2018, 6:31 PM
Jeremy
Jeremy - avatar
- 1
split the strings into the words, interate over the words and put them in a hashmap, the word is the key, increase the value by one when same word occures. done
7th Jan 2018, 6:27 PM
Jeremy
Jeremy - avatar