Using a Hash Set to Count Unique Morse Code Transformations
Initialize a list of Morse code representations for each letter of the alphabet.
Initialize an empty hash set to store unique Morse code transformations.
Iterate over each word in the given list of words.
a. Initialize an empty string to build the Morse code transformation for the current word.
b. For each letter in the current word, find the corresponding Morse code from the list and append it to the transformation string.
c. Add the transformation string to the set.
After iterating through all words, return the size of the set, which represents the number of unique transformations.
Using a Dictionary to Count Unique Morse Code Transformations