Time limit
2s
Memory limit
128 MB
Youngsik wants to share his new mobile phone number with friends in a form that is easy to remember. The phone number is a string of N digits, and it must be split with hyphens (-). Each group must contain exactly 2 or 3 digits.
Each group belongs to one of the following three types.
000 and 77.030, 229, and 116.123 and 90.The quality of a formatted phone number is defined as follows.
2 * (number of O groups) + (number of G groups)
Given Youngsik's phone number, output a valid formatting whose quality is as large as possible.
The first line contains Youngsik's phone number.
The phone number consists only of digits from 0 to 9, and its length is between 2 and 1,000 inclusive.
Output a valid formatting of the phone number with maximum quality.
Separate adjacent groups with hyphens (-). If there is more than one maximum-quality formatting, output the lexicographically smallest one. String comparison uses the following order.
- < 0 < 1 < 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9
For the first visible test, the phone number can be split in several ways.
508-86-38: quality 050-886-38: quality 150-88-638: quality 2Therefore the maximum-quality formatting is 50-88-638.