From: Jan "Yenya" Kasprzak Date: Sun, 6 Dec 2020 10:44:16 +0000 (+0100) Subject: 12.pl ocesane o debugovaci bastly X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=aoc2020.git;a=commitdiff_plain;h=51796598033289595020678eb1b8f3b4bcf9b878 12.pl ocesane o debugovaci bastly --- diff --git a/12.pl b/12.pl index c24e26c..c8b97b9 100755 --- a/12.pl +++ b/12.pl @@ -1,7 +1,6 @@ #!/usr/bin/perl -w use strict; -use Data::Dumper; local $/ = "\n\n"; @@ -10,12 +9,11 @@ my $sum = 0; while (<>) { my $nper = 0; my %q; - for my $per (split /\n/) { + for (split /\n/) { $nper++; - $q{$_}++ for grep { /\S/ } split(//, $per); + $q{$_}++ for split //; } - my $count = grep { $q{$_} == $nper } keys %q; - $sum += $count; + $sum += grep { $q{$_} == $nper } keys %q; } print "$sum\n";