Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Two lines proc solution in Creative category for Count Morse by CDG.Axel
D = {"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": "--.."}
# version without set
def count_morse(message: str, letters: str) -> int:
return sum(count_morse(message[len(D[sym]):], letters.replace(sym, ''))
for sym in letters if message.startswith(D[sym])) if letters else 1
May 16, 2023