DMPG '15 B1 - Loner Phoner

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 32M

Problem type

Bob would like to go on a camping trip with some friends, but unfortunately, Bob spent too much time writing problems for DMPG Silver, leaving him with no friends who want to go with him. He asks them for their phone numbers so he can contact them later, but they do not like Bob, and they either did not format their phone numbers or simply left him with fake numbers. Can you help Bob sort out his contacts list?

A valid phone number consists of 10 digits, with the first three digits being the area code. Bob formats his phone numbers by putting the area code in brackets, followed by a -, followed by the next three digits of the phone number, followed by another dash, then finally the last four digits. Bob does not know many area codes, and therefore only considers 416 and 647 to be valid area codes.

Input Specification

The first line will contain an integer N (1 \le N \le 1000). This will be followed by N lines, each with a string of no more than 50 digits, representing a possible phone number.

Output Specification

Output N lines, each line containing the properly formatted phone number, or not a phone number if the phone number is not a valid number.

Sample Input


Sample Output

not a phone number
not a phone number
not a phone number


  • 3
    echofox  commented on Sept. 21, 2017, 7:38 p.m.

    these friends are snakes if bob didnt sort the numbers he wouldve called the police

  • -10
    Hamdan_Khan  commented on Oct. 25, 2016, 12:12 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

  • -14
    susheelk  commented on Nov. 24, 2015, 12:34 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.

    • 7
      bobhob314  commented on Nov. 24, 2015, 12:56 a.m.

      no, too long