Source Code: https://thecodingsimplified.com/get-most-frequent-word-in-given-string/
- Replace all punctuations with space
- Split string to string array by one or more space
- Create frequency map of each word
- Now create TreeMap with comparator based on decresing frequency & alphabetically
- Put all values in TreeMap which'll arrange in decresing frequency & alphabetically (If frequency is same then alphabetically)
- Get most frequency value
- Put all word from map one by which has frequency equal to most frequency.
- Return this final list
For more info, please see the video.
CHECK OUT CODING SIMPLIFIED
https://www.youtube.com/codingsimplified
★☆★ VIEW THE BLOG POST: ★☆★
http://thecodingsimplified.com
I started my YouTube channel, Coding Simplified, during Dec of 2015.
Since then, I've published over 500+ videos.
★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★
https://www.youtube.com/codingsimplified?sub_confirmation=1
★☆★ Send us mail at: ★☆★
Email: [email protected]