Description
Solutions
Count Triple
🤘 INTERN

Checkout the image source below for the original problem statement :P

Once upon a time, in the land of letters and words, there was a string called "sentence." This string was filled with words, and hidden among them were special words that contained a secret: within each of these words, one letter appeared at least three times. These magical "triple-letter" words held a unique charm, but they were hard to spot because the letters could be in any form, whether uppercase or lowercase. Your quest is to wander through the sentence and find all of these enchanted words, where the same letter appears at least three times, no matter its case. A word in this sentence is a sequence of English letters surrounded by white spaces, marking the boundaries of each word. You don’t need to rush to find the most efficient solution. As long as your method can explore each word carefully—checking the length of the sentence and the longest word within—it will be more than enough to solve the riddle within the limits of time. Go forth, and count all the special words hidden in the sentence!

Example 1:

Input:  sentence = "Dooddle moodle Pepper unsuccessfully"
Output: 3
Explanation:
Checkout the image source below for the original problem statement :P Let’s dive into the magical realm of the sentence and explore each word together: First, we stumble upon the word "Doodle", and with a little inspection, we notice the letter "d" appears three times. This word is enchanted with a triple repeating letter! Next, we find the word "moodle." But alas, no letter appears three times, so this word doesn't hold the magic of triple repetition. Then comes "Pepper," where the letter "p" makes its presence known not once, not twice, but three times. Another enchanted word! Finally, we meet the word "unsuccessfully." This word is filled with magic, as two letters—"u" and "s"—each appear three times, making it twice as special. After our journey through the sentence, we’ve discovered three magical words that contain letters repeating at least three times. Therefore, the function should return 3, marking the count of these special words!
Constraints:
    Unknwon for now
Thumbnail 0
Thumbnail 1
Testcase

Result
Case 1

input:

output: