2016-06
This commit is contained in:
parent
64fc6fade0
commit
9e72485aad
20
2016/06/1.pl
Normal file
20
2016/06/1.pl
Normal file
@ -0,0 +1,20 @@
|
||||
use 5.20.0;
|
||||
|
||||
use List::UtilsBy qw/ max_by /;
|
||||
|
||||
my @message;
|
||||
|
||||
while(<>) {
|
||||
chomp;
|
||||
my @letters = split '';
|
||||
while( my( $i, $l ) = each @letters ) {
|
||||
$message[$i]{$l}++;
|
||||
}
|
||||
}
|
||||
|
||||
use DDP;
|
||||
|
||||
for my $m ( @message ) {
|
||||
print max_by { $m->{$_} } keys %$m;
|
||||
}
|
||||
|
20
2016/06/2.pl
Normal file
20
2016/06/2.pl
Normal file
@ -0,0 +1,20 @@
|
||||
use 5.20.0;
|
||||
|
||||
use List::UtilsBy qw/ max_by min_by /;
|
||||
|
||||
my @message;
|
||||
|
||||
while(<>) {
|
||||
chomp;
|
||||
my @letters = split '';
|
||||
while( my( $i, $l ) = each @letters ) {
|
||||
$message[$i]{$l}++;
|
||||
}
|
||||
}
|
||||
|
||||
use DDP;
|
||||
|
||||
for my $m ( @message ) {
|
||||
print min_by { $m->{$_} } keys %$m;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user