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 consists of several lines of Morse code.
Print every line once decoded.
Input
..-.-....--.......--.-....--...-.....-..-....---.....-......-.. ....-.---...--.-....-.-....---..--....----....-.--.....---.-...-.-. ...-....--...-..-....-...-...-.--....--..-....--.--....---.. ....-......-..-...-.--...----...-.-.....-.-.....--..
Output
ABCDEFGHI JKLMNOPQR STUVWXYZ HI WORLD