P27833 [洛谷] [Information and Future 2021] Morse Code
普及-
题目描述

Background

Early telegraph machines could only express two states: circuit conduction and circuit disconnection. When the circuit was conductive, the speaker could produce sound; when it was disconnected, it remained silent. How could such a machine transmit signals that humans could understand? Clever as you are, you must have thought of using the length of time to convey different meanings (for example, long for $\tt{1}$ and short for $\tt{0}$), and then mapping the binary sequence of $\tt{01}$ to characters.

Problem Description

Morse code is such an early digital communication protocol, which represents different English letters through the length of the speaker's sound:

  1. A dot (half-width dot .): the speaker sounds for 1 unit of time, pronounced as "dit" ($\tt$);
  2. A dash (half-width hyphen -): the speaker sounds for 3 units of time, pronounced as "dah" ($\tt$);
  3. Pauses between characters/words: a pause between characters for 3 units of time, and a pause between words for 7 units of time.

The figure below lists the correspondence between Morse code and English letters:

For example, try translating ... --- ... according to the table above (spaces represent character separation). Yes, this is the famous "$\tt$" emergency signal. Now, you need to write a program to translate the received Morse code back into English characters.

Input Format

The first line of the input data is an integer $n$, representing the number of English letters to be decoded.

The second line contains $n$ strings of Morse code dots/dashes (separated by a space), each string consisting of several half-width hyphens - and half-width dots ., and is guaranteed to be translatable into one of the 26 English letters.

Output Format

Output a single line, which is the string obtained after decoding the Morse code.

Sample Input and Output

Sample Input #1

3
... --- ...

Sample Output #1

SOS

Sample Input #2

35
- .... . --.- ..- .. -.-. -.- -... .-. --- .-- -. ..-. --- -..- .--- ..- -- .--. ... --- ...- . .-. - .... . .-.. .- --.. -.-- -.. --- --.

Sample Output #2

THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG

Notes

Explanation: The quick brown fox jumps over the lazy dog is a classic sentence that includes all 26 letters. Additionally, please note that due to text width limitations, the Morse code in the second sample input has been broken into lines. In the actual input data, all Morse code is on the same line.

For $100\%$ of the data, $1 \leq n \leq 10^3$.

This problem originally had a full score of $15\text{pts}$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 ... --- ...
样例输出
SOS