Problem 58583. Word with Highest Frequency
Write a MATLAB function that takes in a string and returns the word with the highest frequency in the string. The function should ignore punctuation and treat uppercase and lowercase letters as the same.
For example, given the string: "The cat and the hat.", the function should return the word "the" since it appears twice, which is the highest frequency among all words.
Write the function word_with_highest_frequency(string) to solve this problem.
- The word returned should be in lowercase.
- Punctuation should be ignored.
- It is guaranteed that there's only 1 answer.
Solution Stats
Problem Comments
-
1 Comment
Srivatsav
on 18 Jul 2023
A very interesting problem.
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
Return the largest number that is adjacent to a zero
5507 Solvers
-
Back to basics 3 - Temp Directory
380 Solvers
-
Generate a random matrix A of (1,-1)
396 Solvers
-
Simple date to serial no. conversion
133 Solvers
-
69 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!