2025-07-31 18:31:00 +0300 MSK
Unique Morse Code Words
Links
Code
MORSE = (".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--..")
class Solution:
def uniqueMorseRepresentations(self, words: List[str]) -> int:
enc = set()
for word in words:
enc.add("".join(MORSE[ord(char) - 97] for char in word))
return len(enc)