private static Dictionary morseCodeDictionary = new Dictionary {
{ ".-", "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" },
{"-----","0" },
{".----","1" },
{"..---","2" },
{"...--","3" },
{"....-","4" },
{".....","5" },
{"-....","6" },
{" --...","7" },
{"---..","8" },
{"----.","9" },
{".-.-.-","."},
{"--..--",","},
{"..--..","?"},
{"-...-","="}
};
private static string DecodeMorse(string morse)
{
string decodeString = "";
string[] arr = morse.Split(' ');
foreach (string item in arr)
{
decodeString += morseCodeDictionary[item];
}
return decodeString;
}
static void Main(string[] args)
{
Console.WriteLine(DecodeMorse(".... . -.-- .--- ..- -.. ."));
Console.ReadKey();
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.