#K72032. Morse Prime Checker

    ID: 33663 Type: Default 1000ms 256MiB

Morse Prime Checker

Morse Prime Checker

This challenge requires you to determine whether a given Morse code string corresponds to a prime number. The Morse code string represents a digit according to the following mapping:

  • .---- → 1
  • ..--- → 2
  • ...-- → 3
  • ....- → 4
  • ..... → 5
  • -.... → 6
  • --... → 7
  • ---.. → 8
  • ----. → 9
  • ----- → 0

Your task is to convert the Morse code into its corresponding digit, check whether the resulting number is a prime number, and then output True if it is prime and False otherwise. If the Morse code is invalid, output an error message.

The formula for checking whether a number \(n\) is prime is to verify that no integer \(i\) in the range \(2 \leq i \leq \sqrt{n}\) divides \(n\) without remainder. That is, \(n\) is prime if and only if \[ n > 1 \quad \text{and} \quad \forall i \in \{2, 3, \dots, \lfloor \sqrt{n} \rfloor\},\; i \nmid n. \]

inputFormat

The input consists of a single line from stdin containing a Morse code string representing a digit. The Morse code will be one of the valid codes listed, otherwise the program should handle it as an error.

outputFormat

Output to stdout a single line: True if the number corresponding to the Morse code is prime, False if it is not prime. In case of an invalid Morse code input, output Error.

## sample
.----
False