Unique Morse Code Words Problem

Unique Morse Code Words Problem — ExecCode Easy DSA Practice

Solve the Unique Morse Code Words problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given an array of strings words where each word can be written as a concatenation of the Morse code of each letter. Your task is to compute the required answer and return the number of different transformations among all words we have. International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: - 'a' maps to ".-", - 'b' maps to "-...", - 'c' maps to "-.-.", and so on.

Examples

Input {"words": ["gin", "zen", "gig", "msg"]}; Output 2. Input {"words": ["a"]}; Output 1

Constraints

1 <= words.length <= 100 1 <= words[i].length <= 12 words[i] consists of lowercase English letters.

Practice Unique Morse Code Words free on ExecCode. Browse DSA problems, topic map, and placement guides.