Morse code

ifnextchar ( ifnextchar (offsettrue(0pt,0pt) offsetfalse ifnextchar
[(0pt,0pt)(0pt,0pt) ifnextchar
[(0pt,0pt)(0pt,0pt)[l](0pt,0pt)(0pt,0pt)[l][] [r]

  --- ------
   A  .-
   B  -...
   C  -.-.
   D  -..
   E  .
   F  ..-.
   G  –.
   H  ....
   I  ..
   J  .—
   K  -.-
   L  .-..
   M  –
   N  -.
   O  —
   P  .–.
   Q  –.-
   R  .-.
   S  ...
   T  -
   U  ..-
   V  ...-
   W  .–
   X  -..-
   Y  -.–
   Z  –..
  --- ------

Morse code is an old method for transmitting text messages, using only
dots (‘.’) and dashes (‘-’). The table to the right shows the
corresponce between each letter and its code.

Note that Morse code is not prefix-free; therefore, something must be
done to distinguish the start of every letter. In this problem, we
prefix every code of length ℓ with ℓ dots, followed by one dash. For
instance, the letter ‘T’ is codified “.--”, the letter ‘E’ is codified
“.-.”, and the letter ‘A’ is codified “..-.-”. Hence, the codification
of “TEA” is “.--.-...-.-”. We also add the ‘empty codification’ “-” to
denote a space.

Your task is simple: decode every given line of Morse code.

Input

Input consists of several lines of Morse code.

Output

Print every line once decoded.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T11:51:31.763Z

© Jutge.org, 2006–2026.
https://jutge.org
