#C11431. Phone Number Formatter
Phone Number Formatter
Phone Number Formatter
You are given a list of exactly 10 integers, each digit of a phone number. Your task is to format these digits into a phone number string of the form \( (XXX) XXX-XXXX \). For example, if the input digits are 1 2 3 4 5 6 7 8 9 0
, then the output should be (123) 456-7890
.
The formatting must follow the pattern exactly, where the first three digits are enclosed in parentheses, followed by a space, then the next three digits, a hyphen, and finally the last four digits.
Input is read from standard input and output is written to standard output.
inputFormat
The input consists of a single line containing 10 space-separated integers. Each integer represents a single digit in the phone number.
Example: 1 2 3 4 5 6 7 8 9 0
outputFormat
Output the formatted phone number as a string in the format (XXX) XXX-XXXX
.
Example: (123) 456-7890
## sample1 2 3 4 5 6 7 8 9 0
(123) 456-7890