
class MorseDecrypt:
    alphabet = [
        ["A", ".-"], ["B", "-..."], ["C", "-.-."], ["D", "-.."], ["E", "."], ["F", "..-."], ["G", "--."], ["H", "...."],
        ["I", ".."], ["J", ".---"], ["K", "-.-"], ["L", ".-.."], ["M", "--"], ["N", "-."], ["O", "---"], ["P", ".--."],
        ["Q", "--.-"], ["R", ".-."], ["S", "..."], ["T", "-"], ["U", "..-"], ["V", "...-"], ["W", ".--"], ["X", "-..-"],
        ["Y", "-.--"], ["Z", "--.."]
    ]

    def latin_to_morse(self, word: str):
        result = ""
        for letter in word:
            for latin, morse in self.alphabet:
                if letter == latin:
                    result += morse
        return result

    def guess_morse_text(self, morse_text):
        return self.guess_chars(morse_text, '', [])

    def guess_chars(self, morse_text: str, plain_text="", char_guesses=None):
        if morse_text == "":
            char_guesses.append(plain_text)
        else:
            for latin, morse in self.alphabet:
                if morse == morse_text[0:len(morse)]:
                    self.guess_chars(morse_text[len(morse):len(morse_text)], (plain_text + latin), char_guesses)
        return char_guesses
