#C11678. Morse Code Encoder

    ID: 41020 Type: Default 1000ms 256MiB

Morse Code Encoder

Morse Code Encoder

In this problem, you are required to implement a Morse code encoder. Given a plaintext message, your task is to convert it into its Morse code representation.

The conversion should follow these rules:

  • Each alphabetic character (A-Z, case-insensitive) and digit (0-9) is mapped to its corresponding Morse code. The mapping is given by: \( 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:\ ----. \).
  • Characters not present in the mapping (such as punctuation) should be ignored.
  • Separate the Morse code representation of individual characters in a word by a single space.
  • Separate words by " / " (a space, a forward slash, and a space).

For example, encoding "HELLO WORLD" should produce:

.... . .-.. .-.. --- / .-- --- .-. .-.. -..

inputFormat

The input consists of a single line containing a plaintext message. The message may contain uppercase and lowercase letters, digits, spaces, and special characters.

outputFormat

Output a single line containing the Morse code representation of the message based on the rules described above.

## sample
HELLO WORLD
.... . .-.. .-.. --- / .-- --- .-. .-.. -..