Description
Solutions
Submission
Narrative Words 🐥

In the narrative of a sentence filled with words, your quest is to seek out those special words that hold a secret: they contain triple repeating letters, where the same letter appears at least three times consecutively. Each word in the sentence is a sequence of English letters bordered by whitespace characters.

As you embark on this linguistic adventure, remember that letters are to be counted regardless of their case. Your task is not to find the most efficient solution, but one that explores the sentence with a time complexity no worse than O(sentence.length * longestWord.length), ensuring it fits within the constraints of time.

The function narrativeWords awaits your guidance. It takes the sentence as input and returns the count of words harboring at least one letter that appears three times consecutively.

For original prompt, pls refer to source images જ⁀➴

Example 1:

Input:  words = "Doodle moodle Pepper unsuccessfully"
Output: 3
Explanation:
Let's examine each word within this sentence: "Doodle" stands out as it contains a triple repeating letter, with "d" appearing three times. "Moodle," however, does not meet the criteria, lacking a letter repeated thrice. "Pepper" catches our attention with its triple repeating letter, "p" occurring three times. As for "unsuccessfully," it impressively boasts not just one, but two triple repeating letters, with both "u" and "s" making their triumphant appearances.
Constraints:
    Unknown for now
Thumbnail 0
Thumbnail 1
Testcase

Result
Case 1

input:

output: