#C14686. Phone Number Formatter

    ID: 44362 Type: Default 1000ms 256MiB

Phone Number Formatter

Phone Number Formatter

You are given a phone number string. A valid phone number follows the format (NXX-NXX-XXXX), where (N) is a digit from 2 to 9 and (X) is a digit from 0 to 9. Your task is to check if the input phone number is valid. If it is valid, output the phone number with dashes replaced by spaces; otherwise, output "Invalid number".

For example, if the input is 234-567-8901, the output should be 234 567 8901, but if the input is 123-456-7890, then the output should be Invalid number.

inputFormat

The input consists of a single line from standard input containing a phone number string. The phone number has exactly 12 characters with dashes at positions 4 and 8.

outputFormat

Output a single line to standard output: if the phone number is valid according to the pattern (NXX-NXX-XXXX) (with the appropriate digit restrictions), output the phone number with dashes replaced by spaces; otherwise, output "Invalid number".## sample

234-567-8901
234 567 8901