use v5.16;
-my @drawn = split/[,\s]/, scalar <>;
-scalar <>;
-
$/ = "\n\n";
+my @drawn = split/[,\s]/, <>;
my @boards = <>;
-say $boards[0];
-
for my $d (@drawn) {
for my $board (@boards) {
$board =~ s/\b$d\b/' ' x length $d/e;
- if ($board =~ / /
- || $board =~ /\s{3}.{12}\s{3}.{12}\s{3}.{12}\s{3}.{12}\s{3}/xms) {
- say $board;
+ if ($board =~ / {14}/
+ || $board =~ /\s{3}(?:.{12}\s{3}){4}/xms) {
$board =~ s/(?<=\d)\s+(?=\d)/+/gxms;
- say "$board";
say eval "$d*($board)";
exit;
}
use v5.16;
-my @drawn = split/[,\s]/, scalar <>;
-scalar <>;
-
$/ = "\n\n";
+my @drawn = split/[,\s]/, <>;
my @boards = <>;
-
-say $boards[0];
-
my $remaining = @boards;
for my $d (@drawn) {
for my $board (@boards) {
$board =~ s/\b$d\b/' ' x length $d/e;
- if ($board =~ / /
- || $board =~ /\s{3}.{12}\s{3}.{12}\s{3}.{12}\s{3}.{12}\s{3}/xms) {
+ if ($board =~ / {14}/
+ || $board =~ /\s{3}(?:.{12}\s{3}){4}/xms) {
if (--$remaining) {
$board = 'x';
next;
}
- say $board;
$board =~ s/(?<=\d)\s+(?=\d)/+/gxms;
- say "$board";
say eval "$d*($board)";
exit;
}