adventofcode/2015/01/d1b.pl
Yanick Champoux 14029d26a5 2015-01
2017-12-03 16:25:02 -05:00

11 lines
162 B
Perl

use 5.20.0;
use List::AllUtils qw/ reduce /;
my $i;
reduce {
my $l = $a + ( $b eq '(' ? 1 : -1 );
$i++;
die $i if $l < 0;
$l;
} 0, split '', <>;