← Back to List

9289번: Morse Code ↗

Solutions

Python 3
439 B | 439 chars
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"}
for t in range(1,int(input())+1):
    s = input()
    L = s.split()
    print("Case {}: {}".format(t,"".join([d[i] for i in L])))