...

/

Feature #6: Combine Similar Messages

Feature #6: Combine Similar Messages

Description

Someone is posting messages on Facebook that are apparently gibberish. Research has indicated that the author picks every word and mutates it by adding a fixed offset value to each letter in the word. For example, they may mutate hy to iz by adding 1 to each letter of hy. Similarly, they may mutate hy to ja by adding 2 to each letter of hy, etc. We want to decode these messages. The first step is to group all the words that may be mutations of each order to make further analysis easier.

We’ll be provided with a list of strings in which each string represents a garbled message. Our task is to group all the messages that differ by the same number of offsets in each of their characters.

Here is an illustration of this process:

Solution

From the ...

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy