# Morse Code To English

Contributed by
Ashwani
Last Updated: 23 Feb, 2023
Easy
0/40
Avg time to solve 15 mins
Success Rate 85 %
Share

## Problem Statement

#### For your convenience, the full table for the 26 letters of the English alphabet and 10 numeric digits is given below:

``````list = [ ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--..", "-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...", "---..", "----." ]

where list[0] represents morse code for ‘a’, list[1] represents morse code for ‘b’, and list[35] represents morse code for ‘9’. Similarly, each letter and numeric is mapped with a morse code given in the list.
``````
Detailed explanation ( Input/output format, Notes, Images )
##### Constraints:
``````1 <= T <= 10
1 <= N <= 5*(10^5)

Time Limit: 1sec
``````
##### Sample Input 1 :
``````2
-.-. --- -.. .. -. --.
-. .. -. .--- .- ...
``````
##### Sample Output 1 :
``````coding
ninjas
``````
##### Explanation For Sample Input 1 :
``````In the first test case, On splitting the given string on the basis of space the list we get is :  [ "-.-.", "---", "-..", "..",  "-.", "--." ] where “-.-.” is morse code for ‘c’ and similarly further in the string.

In the second case, On splitting the given string on the basis of space the list we get is : [ "-.", "..", "-.", ".---", ".-", "..." ], where “-.” is morse code for ‘n’ and similarly further in the string.
``````
##### Sample Input 2 :
``````2
----. ---.. ....- ..... -----
-.. .... --- -. .. --... --...
``````
##### Sample Output 2 :
``````98450
dhoni77
``````
Auto
Console