DMPG '15 B1 - Loner Phoner

View as PDF

Submit solution

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 \le1000). 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


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

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

  • -10
    Hamdan_Khan  commented on Oct. 24, 2016, 8:12 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

  • 1
    jg119  commented on Jan. 18, 2016, 8:22 p.m.

    I keep getting WA for #5, anyone else having that problem?

  • -13
    susheelk  commented on Nov. 23, 2015, 7:34 p.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

    • 9
      bobhob314  commented on Nov. 23, 2015, 7:56 p.m.

      no, too long