gilbert's test heap

formatted phone numbers

|`*$)`+^,#|~:|.,`)}|><|_@.#!;`&}


a phone number is considered "correctly formatted" if it is in the form of

(XXX) XXX-XXXX

it needs to have:

- a three-digit area code surrounded with parentheses

- a space followed by 3 digits, a hyphen, and 4 more digits (what is the back end of a phone number called lol)

examples of "correctly formatted" phone numbers:

(646) 123-4567, (123) 009-2025, (800) 232-8635

examples of incorrectly formatted phone numbers:

(A24) 293-1020 (first digit is not a number)

624-293-1020 (missing parenthesis)

(624)293-1020 (missing space)

(624) 2931020 (missing hyphen)

(624) 293-120 (not 10 digits long)

(624) 2932-120 (digits not hyphenated correctly)

of the input, how many are formatted "correctly"?


to view the input and attempt solutions.