Morse decode by Hendrik

c={'.-':'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','.-.-.-':'.','--..--':','};d=s=''\x0d
for x in raw_input()+'/':\x0d
 if x!='/'and x!=' ':d+=x\x0d
 else:s+=c[d];d=''\x0d
 if x==' ':s+=x\x0d
print s\x0d

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top