#C13316. Morse Code Converter

    ID: 42841 Type: Default 1000ms 256MiB

Morse Code Converter

Morse Code Converter

Given a string S containing English letters (both uppercase and lowercase) and digits, your task is to convert the string into its equivalent Morse code using the International Morse Code standard. Each Morse code letter (or digit) must be separated by a single space.

Any character that is not an English letter or digit should be ignored. For a given character c in the input, the conversion is defined as:

\( f(c) = \text{Morse}(c) \)

where the mapping is as follows:

  • Letters: A to Z (or a to z) map to their respective Morse codes (e.g. A: .-, B: -..., etc.)
  • Digits: 0 to 9 map to their Morse codes (e.g. 0: -----, 1: .----, etc.)

Output the resulting Morse code for the full string. For instance, the conversion of "HELLO" is ".... . .-.. .-.. ---".

inputFormat

The input consists of a single line containing the string S. The string may contain letters, digits, spaces, and other characters. Only English letters and digits are to be considered for conversion.

outputFormat

Output a single line that is the Morse code conversion of the input string. Each Morse code representation for a valid character must be separated by a single space.

## sample
HELLO
.... . .-.. .-.. ---