Under construction

Still being built. Things may change

Morse Code

Time limit1sMemory limit1024 MB

Summary
Given a Morse code message with characters separated by spaces, the task is to decode it back into the original string of length N.
Level

Easy2 of 10

Topics
String, Hash map, Implementation
Solved
No attempts yet

Problem

Hyemin has recently become interested in Morse code. Morse code writes letters and symbols by combining short and long signals. The encoding of each character is fixed in advance. For example, if a short signal is '.' and a long signal is '-', then the letter 'A' is written as '.-' and the digit 1 is written as '.----'. Knowing Morse code could help in an emergency when someone needs to call for rescue, so Hyemin plans to use it when chatting with friends in everyday life. Hyemin wants to check right away whether the Morse messages from friends were decoded correctly. Given a Morse message converted from a string of length NN made of the letters A-Z, the digits 0-9, and the symbols ',', '.', '?', ':', '-', and '@', write a program that decodes the message and prints the original string.

The table below lists how each character is written in Morse code. (The second and fourth columns are the Morse codes for the characters in the first and third columns. '.' is a short signal and '-' is a long signal.)

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--..
1.----2..---
3...--4....-
5.....6-....
7--...8---..
9----.0-----
,--..--..-.-.-
?..--..:---...
--....-@.--.-.

Input

The first line contains an integer NN (1≤N≤1001 \leq N \leq 100), the length of the string before it is converted to Morse code.

The second line contains the Morse code message. Short signals are '.' and long signals are '-'. The Morse code for each character is separated by a space.

The input never contains a message that cannot be decoded with the table above.

Output

Print the decoded original string of length NN without spaces.

Letters must be printed in uppercase.

Examples1

  1. Example 1

    Input
    5
    .... . .-.. .-.. ---
    
    Expected output
    HELLO