# # whether a given integer is contained inside a given set of integer ranges # here we just check each of the constraints, inverting the check when necessary, # the result is the product of each check. # my ($tests, $number) = $*IN.lines; exit say $number ?? "no" !! "invalid input" unless $tests; say ( [*] gather for $tests.split(/\]/) -> $item { next unless $item; $item ~~ m:s /(<[+\-]>) \[ (\d+) \.\. (\d+)/ or exit say "invalid input"; my $ok = $1 <= $number <= $2; take $0 eq '+' ?? $ok !! !$ok }) ?? "yes" !! "no";