Feature #5: Flag Words

Implementing the "Flag Words" feature for our "Facebook" project.


Facebook recently conducted a survey on the techniques people use to hide offensive or profane words. The goal was to flag such words in the posts and messages of users. The most observable pattern was that the characters of a word were repeated multiple times to avoid detection. A single character in a word was observed to be repeated at least 3 times. This means that characters repeated less than 3 times will be ignored in the detection process.

We’ll be provided with a string, S, representing the profane or offensive input word and another string, W, representing the original word. We have to determine if the original word, W, can be modified into S following the above-mentioned rules.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.