Submit | All submissions | Best solutions | Back to list |
EIPAGES - Page numbers |
When listing document page numbers, it is common to use "-" for the first and last page numbers instead of all pages for at least 3 consecutive pages. Given page numbers needed to list, use the "-" sign to shorten the list
Input
The first line is N, 1≤N≤1000 , the page number listed.
The next line contains N integers, representing page numbers. The numbers are all unique.
The first line is N, 1≤N≤1000 , the page number listed.
The next line contains N integers, representing page numbers. The numbers are all unique.
Output
Print out a list of pages in order from smallest to largest.
Example
Input: 6 180 141 174 143 142 175 Output: 141-143 174 175 180
Added by: | Ha Minh Ngoc |
Date: | 2019-04-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |