Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, such as:
'a'maps to".-"'b'maps to"-..."'c'maps to"-.-."
For convenience, the full table for the 26 letters of the English alphabet is:
[".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]
Given an array of strings words, each word can be written as a concatenation of the Morse code of each letter. We call such a concatenation the transformation of a word.
Return the number of different transformations among all words in words.
words = ["gin","zen","gig","msg"]2"--...-." for "gin" and "zen", and "--...--." for "gig" and "msg", so there are 2 different transformations.words = ["a"]1Constraints
- 1 <= words.length <= 100
- 1 <= words[i].length <= 12
- words[i] consists of lowercase English letters.