Problem of the day
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.
The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.
The first line of each test case contains the morse code in the form of a string.
For each test case, print the equivalent alphanumeric code of the given morse code in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 5*(10^5)
Time Limit: 1sec
2
-.-. --- -.. .. -. --.
-. .. -. .--- .- ...
coding
ninjas
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.
2
----. ---.. ....- ..... -----
-.. .... --- -. .. --... --...
98450
dhoni77