]> www.fi.muni.cz Git - aoc.git/blob - 2018/03.pl
Year 2018
[aoc.git] / 2018 / 03.pl
1 #!/usr/bin/perl -w
2
3 use v5.30;
4 use strict;
5
6 my ($two, $three);
7 while (<>) {
8         chomp;
9         my %h;
10         $h{$_}++ for split //;
11         $two++ if grep { $_ == 2 } values %h;
12         $three++ if grep { $_ == 3 } values %h;
13 }
14
15 say $two * $three;
16
17