#!/usr/bin/perl for (<STDIN>){ @b = (); for (/([-\d]+)/g) { $a[1] = $a[0] unless $a[1]; ($a[1], $a[0]) = ($a[0], $a[1]) if $a[0] > $a[1]; } $i = $c[0][0]-1; my @d; for (@c) { for ($_->[0] .. $_->[1]) { if ($i < $_) { $i = $_; } } } }
>>1 >>1-3 >>1,3 >>1-3,5,9-10 >>000000-000000001 >>289494 >>0-2,99998-100000 >>3,0-3,4,5,6,4,2-8 >>4-1
>>1 [1] >>1-3 [1,2,3] >>1,3 [1,3] >>1-3,5,9-10 [1,2,3,5,9,10] >>000000-000000001 [0,1] >>289494 [99999] >>0-2,99998-100000 [0,1,2,99998,99999] >>3,0-3,4,5,6,4,2-8 [0,1,2,3,4,5,6,7,8] >>4-1 [1,2,3,4]