Example 1: Translate text into Morse code
Input (text):
Hello World
Output (Morse code):
.... . .-.. .-.. --- / .-- --- .-. .-.. -..| Characters | Morse code | Units |
|---|---|---|
| H | .... | 7 |
| E | . | 1 |
| L | .-.. | 9 |
| O | --- | 11 |
| W | .-- | 9 |
| R | .-. | 7 |
| D | -.. | 7 |
In words: 2 words with 10 letters become Morse code, with each letter represented by its own group of dots and dashes. Letters are separated by spaces and words by slashes. Decoding the code gives “HELLO WORLD” again.
