#K95477. Morse Code Translator
Morse Code Translator
Morse Code Translator
In this problem, you are required to convert an English sentence into International Morse Code. Each letter and digit is represented by a specific sequence of dots and dashes in Morse code. Letters are case-insensitive, and any unrecognized characters (such as punctuation) should be ignored.
Follow these rules to perform the translation:
- Convert all letters to uppercase.
- Separate the Morse code for each character within a word by a single space.
- Separate words by three spaces.
For example, the translation of HELLO WORLD
is .... . .-.. .-.. --- .-- --- .-. .-.. -..
.
inputFormat
The input consists of a single line from standard input (stdin
) containing the sentence to be translated into Morse code. The sentence may include letters, digits, spaces, and punctuation marks.
outputFormat
Output the Morse code translation of the given sentence to standard output (stdout
) following the rules described above. There should be no extra leading or trailing spaces in the output, and unrecognized characters must be ignored.
HELLO WORLD
.... . .-.. .-.. --- .-- --- .-. .-.. -..