]> www.fi.muni.cz Git - aoc2021.git/blob - 19.pl
Day 25: pretty straightforward
[aoc2021.git] / 19.pl
1 #!/usr/bin/perl -w
2
3 use v5.16;
4
5 my %score_of = (
6         ')' => 3,
7         ']' => 57,
8         '}' => 1197,
9         '>' => 25137,
10 );
11
12 my $sum;
13 while (<>) {
14         chomp;
15         1 while s/\(\)|\[\]|\{\}|\<\>//;
16         s/^[\(\[\{\<]*//;
17         next if !length;
18         $sum += $score_of{substr($_, 0,1)};
19 }
20
21 say $sum;
22