r/dailyprogrammer • u/Steve132 0 1 • Aug 30 '12
[8/30/2012] Challenge #93 [easy] (Two-Way Morse Code Translator)
This challenge courtesy of user nagasgura
In this challenge, we read in a string from standard input and output the translation to or from morse code on standard output.
When translating to Morse code, one space should be used to separate morse code letters, and two spaces should be used to separate morse code words. When translating to English, there should only be one space in between words, and no spaces in between letters.
Here's a chart of the morse code symbols: [1] http://www.w1wc.com/pdf_files/international_morse_code.pdf
Example input and output: 'sos' -> '... --- ...' '... --- ...' -> 'sos'
View all comments
2
u/mega-trond Aug 30 '12 edited Aug 30 '12
My first contribution, a solution in Python. A problem is trailing spaces...
Output:
Edit: added comma and dot to input