]> www.fi.muni.cz Git - aoc2020.git/blob - 12.pl
Task 9 Perl Golf-style
[aoc2020.git] / 12.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 local $/ = "\n\n";
6
7 my $sum = 0;
8
9 while (<>) {
10         my $nper = 0;
11         my %q;
12         for (split /\n/) {
13                 $nper++;
14                 $q{$_}++ for split //;
15         }
16         $sum += grep { $q{$_} == $nper } keys %q;
17 }
18
19 print "$sum\n";
20