<jupyter_start><jupyter_text>说明：    国际摩尔斯电码定义了一种标准编码，其中每个字母映射到一系列点和破折号，    如下所示：        “a”映射到“ .-”，        “b”映射到“ -...”，        “ c”映射到“-.-."， 等等。    为方便起见，下面列出了英文字母的26个字母的完整表格：        [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.",         "--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]    现在，给定单词列表，可以将每个单词写成每个字母的摩尔斯电码的串联。    例如，        “cab”可以写为“ -.-..--...”（它是串联的“ -.-。”，“ .-”“ -...”）。    我们称其为串联，即单词的转换。    返回我们所有单词中不同变换的数量。Example:    Input: words = ["gin", "zen", "gig", "msg"]    Output: 2    Explanation:     The transformation of each word is:        "gin" -> "--...-."        "zen" -> "--...-."        "gig" -> "--...--."        "msg" -> "--...--."    There are 2 different transformations, "--...-." and "--...--.".Note:    1、The length of words will be at most 100.    2、Each words[i] will have length in range [1, 12].    3、words[i] will only consist of lowercase letters.<jupyter_code># c = -.-.
# a = .-
# b = -...
# -.-. .- -...
class Solution:
    def uniqueMorseRepresentations(self, words) -> int:
        if not words: return 0
        morse = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.", "--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."]
        res = set()
        for w in words:
            s = ''
            for a in w:
                s += morse[ord(a) - 97]
            if s:
                res.add(s)
        return len(res)
solution = Solution()
solution.uniqueMorseRepresentations(["gin", "zen", "gig", "msg"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.36561142147734327, 'fraction_numerical': 0.009931719428926133, 'mean_word_length': 1.5031055900621118, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '580753', 'license': 'Apache-2.0', 'n_tokens_mistral': 710, 'n_tokens_neox': 723, 'n_words': 107, 'path': 'String/1010/804. Unique Morse Code Words.ipynb', 'repo_name': 'YuHe0108/Leetcode', 'size': '1611'}