D - TelephoneticsYou've been hired as a programmer by a large telephone company. Your job is to take their existing member database and transfer all the data into their new system. The biggest problem is the way telephone numbers are represented in the old database. There are three different ways to specify a phone number:
The company would like to convert all numbers to the type 1 representation (area code in parentheses, followed by 3 digits, a hyphen and 4 more digits) before putting the numbers into the new system. InputThe input will consist of a sequence of old-style phone numbers, one per line. If the area code is written in parentheses, there can be one or more spaces between the closing parenthesis and the next digit. For example,
are both valid old-style phone numbers. There will be no invalid or incorrect numbers given as input; however, leading and trailing spaces on each line are allowed. OutputYou will need to output one new-style number on a separate line for each of the input numbers. There should be no spaces between the closing parenthesis and the next digit. Each line should be exactly 13 characters long (10 digits, two parentheses and a hyphen). Note that the phone company is located in Vancouver, so the default area code for phone numbers that do not provide one is 604. See the sample input and output for more information. Sample input822-2222 (123) 456-7890 1-800-999-9999 Sample output(604)822-2222 (123)456-7890 (800)999-9999 |