There are two methods used by phones to dial phone numbers, and one of them is pulse dial. In pulse dial, a phone number is represented as a sequence of pulses and pauses. Each maximal consecutive sequence of pulses represents a single digit. We will use the character '-' to denote a pulse and '*' to denote a pause. Digit '1' is represented as '-', digit '2' is represented as '--', and so on. Digit '0' consists of 10 dashes.
Given a String containing a sequence of pulses and pauses, return the phone number that it represents. If it is a 7-digit number, format the String as "XXX-XX-XX", and if it is an 11-digit number, prefix it with a '+' character: "+XXXXXXXXXXX". The phone number is guaranteed to contain exactly 7 or 11 digits.
|