FA-96400 / Phone number formatting / Member archive
Variable-length area code grouping: the shortest matching area code is used · case 05
"04012 ..." is grouped as area 040.
Case contract
Keep digits and drop one leading trunk 0; nine national digits must remain. Numbers starting 7 are mobile with a four-digit block code; otherwise the area code is the longest match from 2, 30, 31, 40, 4012 (no match -> None). The subscriber part is one group if at most 5 digits, two equal halves if even, else 3 then the rest. Return "0" + area + " " + groups joined by spaces.
Why this case matters
Area codes of different lengths share leading digits; choosing the wrong one regroups every digit and prints a number users cannot dial.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| long area code wins over its prefix | "040 120 5678" | "04012 05678" | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗