5 lines
212 B
Raku
5 lines
212 B
Raku
grammar BalBrack { token TOP { '[' <TOP>* ']' } }
|
|
|
|
my $n = prompt "Number of bracket pairs: ";
|
|
my $s = ('[' xx $n, ']' xx $n).flat.pick(*).join;
|
|
say "$s { BalBrack.parse($s) ?? "is" !! "is not" } well-balanced";
|