2015-01
parent
eebed65b33
commit
14029d26a5
|
@ -0,0 +1,4 @@
|
|||
use 5.20.0;
|
||||
|
||||
say eval <> =~ s/\(/+1/gr =~ s/\)/-1/gr;
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
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 '', <>;
|
Loading…
Reference in New Issue