This page is still under construction.

Parts of this page are still being built. What you see may change.

Morse Code

Time limit1sMemory limit128 MB

Summary
Decode each test case of five space-separated Morse codes into five uppercase letters or digits.
Level

Easy2 of 10

Topics
Hash map, String
Solved
No attempts yet

Problem

Morse code was an early way to send text over electrical signals. Every letter and digit has its own pattern of short and long tones, and a pause marks the boundary before the next character.

Read the table below and decode five-letter messages. Every message is exactly five characters long.

CharacterCodeCharacterCodeCharacterCode
A.-N-.0-----
B-...O---1.----
C-.-.P.--.2..---
D-..Q--.-3...--
E.R.-.4....-
F..-.S...5.....
G--.T-6-....
H....U..-7--...
I..V...-8---..
J.---W.--9----.
K-.-X-..-
L.-..Y-.--
M--Z--..

Input

The first line contains the number of test cases.

Each test case is a single line with five Morse code characters, separated by spaces. Each code is made of dots (.) and dashes (-).

There are at most 1000 test cases.

Output

For each test case, print one line in the form Case x: MESSAGE. Here x is the case number, counting from 1, and MESSAGE is the decoded message written as five uppercase alphanumeric characters.

Examples1

  1. Example 1

    Input
    5
    ... ..- .--. . .-.
    ... .- .-.. .- -..
    --.- ..- . ... ---
    -.. .. ... -.-. ---
    -. -.-- .-.. --- -.
    
    Expected output
    Case 1: SUPER
    Case 2: SALAD
    Case 3: QUESO
    Case 4: DISCO
    Case 5: NYLON