There is no simple optimal structure - for any given fixed mapping there can be diabolical bit-torsion optimizers for this exact mapping, which are better or worse on different architectures and different inputs. The map / dictionary should be pretty good all the time, and the code is pretty simple.
My official advice is to stick with this. Search efficiency is very unlikely for such code, since most likely you can easily encode / decode faster than you can input / output.
, : → , /. , , ++ . , char , A, :
std::string encode['Z'-'A'];
encode['A' - 'A'] = ".-";
encode['B' - 'A'] = "-...";
encode['Z' - 'A'] = "--..";
, , (true ASCII, EBCDIC), :
std::string encode[26] = {".-", "-...", "--.."};
, c:
morse = encode[c - 'A'];
Python ASCII ( ), ord.
-, , ( char), , ..