LearnPy Hub
← Arena
IntermediateRating 1100

Summarise the Ranges

The numbers are sorted and distinct. Group consecutive runs and print them like 0->2, 4->5, 7 separated by spaces.

Input

n, then n integers.

Output

One line.

Sample 1

Input
6
0 1 2 4 5 7
Output
0->2 4->5 7

Sample 2

Input
6
0 2 3 4 6 8
Output
0 2->4 6 8
solution.py
Output appears here
Summarise the Ranges · Python Arena problem · LearnPy Hub