Bracket Match

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/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";
}