# e589. 11223 - O: dah dah dah! ## 題目連結: [e589](https://zerojudge.tw/ShowProblem?problemid=e589) 在寫得過程中最麻煩的就是初始化dictionary的部分,後來我卡在兩個空格表示單字之間的空格的部分,其實只要一開始輸入時用.split(" ")就可以解決了。 ```python= n = int(input()) s = {".-":"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", "-----":'0',".----":'1',"..---":'2',"...--":'3', "....-":'4',".....":'5',"-....":'6',"--...":'7', "---..":'8',"----.":'9', ".-.-.-":'.', "--..--":',', "..--..":'?', ".----.":"'", "-.-.--":'!', "-..-.":'/', "-.--.":'(', "-.--.-":')', ".-...":'&', "---...":':', "-.-.-.":';', "-...-":'=', ".-.-.":'+', "-....-":'-', "..--.-":'_', ".-..-.":'"', ".--.-.":'@', '':' ' } for i in range(n): a = list(input().split(" ")) m = "" for j in range(len(a)): m += s[a[j]] print("Message #"+str(i+1)) print(m) ```