root@coding-prodigies:~#
← All challenges

Most Frequent Word

Find which word appears the most in a sentence -- and how many times.

🔴 ExtremeDifficulty

The challenge

Given "the quick brown fox the lazy dog the fox jumps", find the word that appears most often and print it followed by a space and its count (e.g. the 3). If there's a tie, use whichever of the tied words appears first in the sentence.

Output

  
🧠 Need a hint? (Python)

Split the text into words, count occurrences with a dict, then walk the words in their original order tracking the highest count seen so far so ties resolve to the first-seen word.

🚀

Like solving these?

Structured courses, hands-on exercises, and real multi-file projects are waiting -- your first project unlock is free.

Create a free account

More challenges