Problem Β· String
Narrative Words π₯
Learn this problemProblem statement
Given a sentence words, count how many words contain at least one English letter that appears three or more times anywhere in that word. The repeated occurrences do not need to be consecutive.
Words consist of English letters and are separated by whitespace. Count letters case-insensitively.
Return the number of qualifying words.
Function
narrativeWords(words: String) β intExamples
Example 1
words = "Dooddle moodle Pepper unsuccessfully"return = 3Dooddle has three occurrences of d, Pepper has three occurrences of p, and unsuccessfully has a letter occurring at least three times. moodle does not qualify.
Constraints
Unknown for now