Bracket Match

#!/usr/bin/env perl6

use v6;

my \stdin = $*IN;

my Int $count = +stdin.get();

for ^$count {
	my Str $str = stdin.get();

	while $str.chars > 0 {
		last unless $str ~~ s:g/[ \[ \] || \( \) ]+//;
	}

	say $str.chars ?? "No" !! "Yes";
}

编程技巧