Problem 1696. Morse Code Generator! Try it!
.... . .-.. .-.. --- . ...- . .-. -.-- --- -. . -.-.-- .-.. . - ... -.. --- ... --- -- . -- --- .-. ... . -.-. --- -.. . -.-.-- .-- . .-.. .-.. - .... .. ... -- --- .-. ... . -.-. --- -.. . --. . -. . .-. .- - --- .-. ..- ... . ... - .... . .. -. - . .-. -. .- - .. --- -. .- .-.. ... - -.-- .-.. . -- --- .-. ... . -.-. --- -.. . .-.-.- - .... . .-.-.- .- -. -.. -- .- -.- . ..- .--. .- .-.. .-.. - .... . -.-. --- -.. . --..-- - .... . .-. . .. ... --- -. . ... .--. .- -.-. . - .... .- - ... . .--. .- .-. .- - . ... .-.. . - - . .-. ... .- -. -.. ..... ... .--. .- -.-. . ... - .... .- - ... . .--. .- .-. .- - . .-- --- .-. -.. ... .-.-.- ... --- -- . .--. ..- -. -.-. - ..- .- - .. --- -. .. ... ..- ... . -.. .-.-.- .-.-.- .-.-.- --- - .... . .-. - .... . -. - .... .- - --..-- .- .-.. .-.. -.-- --- ..- -. . . -.. - --- -.. --- .. ... - .- -.- . .. -. ... --- -- . - -.-- .--. . --- ..-. - . -..- - .. -. - .... . ..-. --- .-. -- --- ..-. .- ... - .-. .. -. --. .- -. -.. - ..- .-. -. .. - .. -. - --- .- -- --- .-. ... . -.-. --- -.. . .-.. .. -. . -.-. .... .- .-. -.-. .-.. .- ... ... --..-- .- ... - .... . . -..- .- -- .--. .-.. . -... . .-.. --- .-- ... .... --- .-- ...
text = 'Morse code is FUN!' Morse_code_out = '-- --- .-. ... . -.-. --- -.. . .. ... ..-. ..- -. -.-.--'
Just a note: this uses international style Morse code found in:
Solution Stats
Problem Comments
-
3 Comments
please either fix it or remove it from the Strings II badge list
The test suite should be working now. I fixed the parentheses problem mentioned in the other comments (it should now recognize left and right parentheses as different). There were also seven spaces between words in the test suite, though the encoded description indicated five—that has been fixed, as well.
American Morse for letters but International one for punctuation + other mixups, to fix
Solution Comments
Show commentsProblem Recent Solvers81
Suggested Problems
-
Find common elements in matrix rows
2628 Solvers
-
1345 Solvers
-
What is the distance from point P(x,y) to the line Ax + By + C = 0?
370 Solvers
-
Rotate input square matrix 90 degrees CCW without rot90
606 Solvers
-
320 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!