Name: Anonymous 2018-01-08 14:27
INPUT: A multi-line string specifying quoted poasts on a 2ch-like board, one poast per line. Lines are prefixed with ``
OUTPUT: A single, optimized quote link, created by replacing consecutive poast numbers with a range.
EXAMPLE INPUT ⅰ
EXAMPLE OUTPUT ⅰ
EXAMPLE INPUT ⅱ
EXAMPLE OUTPUT ⅱ
EXAMPLE INPUT ⅲ
EXAMPLE OUTPUT ⅲ
🌑 In case of only two consecutive poasts, still replace them with a range.
🌑 Numbers are positive integers from 1 too 1001 (inclusive on both sides).
🌑 Use standard input and standard output as interfaces.
🌑 Shortest code wins. Good luck!
>>
''.OUTPUT: A single, optimized quote link, created by replacing consecutive poast numbers with a range.
EXAMPLE INPUT ⅰ
>>1
>>2
>>3
EXAMPLE OUTPUT ⅰ
>>1-3
EXAMPLE INPUT ⅱ
>>1
>>3
>>2
>>5
EXAMPLE OUTPUT ⅱ
>>1-3,5
EXAMPLE INPUT ⅲ
>>6
>>2
>>3
>>1
>>5
EXAMPLE OUTPUT ⅲ
>>1-3,5-6
🌑 In case of only two consecutive poasts, still replace them with a range.
🌑 Numbers are positive integers from 1 too 1001 (inclusive on both sides).
🌑 Use standard input and standard output as interfaces.
🌑 Shortest code wins. Good luck!