raw consists of digits, spaces and dashes. Bring the number to one standard look.
1. Remove every space and dash so only the digits remain.
2. Going left to right, cut off blocks of three digits while more than four digits are left.
3. Group the rest as follows: 2 digits make one block of two, 3 digits make one block of three, 4 digits make two blocks of two.
Join the blocks with dashes and return the result. Note that a block of a single digit never appears.raw="8 800-55 53" → '880-055-53'
The digits are 88005553, eight of them. First 880, then 055, and the two remaining digits 53 form one block.
raw="4-0-7 1" → '40-71'
There are exactly four digits, so they split into two blocks of two: 40-71.
raw="12 34567" → '123-45-67'
raw consists of digits, spaces and - charactersraw contains at least two digitsraw="8 800-55 53"
'880-055-53'
Run checks the first 3 tests in your browser. Submit checks all 162 tests on the server, hidden ones included.