Top 3 frequent words (case-insensitive, tie by lexicographic order)

Problem: Word frequency (return at most 3 words)

Given a string s containing words separated by spaces and/or punctuation, count the occurrences of each word in a case-insensitive manner (e....

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: