#B3757. Morse Code Translator
Morse Code Translator
Morse Code Translator
Morse code is an early digital communication protocol where a horn (or similar device) emits sounds of different durations to represent different English letters. Specifically:
- A dot (represented by a period
.
) sounds for $1$ unit of time and is called adit
. - A dash (represented by a hyphen
-
) sounds for $3$ units of time and is called adah
. - Pauses between letters last for $3$ time units, and pauses between words last for $7$ time units.
The image below shows the correspondence between Morse code and the English letters.
For instance, converting the Morse code ... --- ...
(with spaces separating characters) yields the famous SOS distress signal. In this problem, you are required to write a program to translate received Morse code back into English characters.
Note: In the input, a single space separates Morse codes for characters, and a sequence of three spaces indicates the separation between words.
inputFormat
The input consists of a single line containing the Morse code message. Individual Morse codes for letters are separated by a single space, and words are separated by three spaces.
outputFormat
Output the corresponding English message in uppercase letters.
sample
... --- ...
SOS