Logo
IconChallenge
Icon
IconProblem
IconSolutions
IconSubmissions

Most Common Word

XPChallenge Points: 10
levelLevel: Easy

You are given a string text and a list of words blocked.
Your task is to find the most frequent word in the text that is not included in the blocked list.
The search should be case-insensitive, and punctuation symbols (such as ,, ., !, ?, etc.) should be ignored.
The result must be returned in lowercase.
It is guaranteed that at least one non-blocked word exists and that the answer is unique.

Example 1:

Input: text = "John played football, then john PLAYED cricket! Played again." blocked = ["played"]

Output: "john"

Example 2:

Input: text = "Rain rain go away!" blocked = ["rain"]

Output: "go"

to Continue
like
dislike

Accepted:

Submission:

IconReport an issue
Icon
IconCode
IconYou need toto run or submitYou need toto run or submit
IconTest Case
IconTest Result