use strict; use warnings; chomp(my $heights = <>); my @heights = split / /, $heights; my @letters = ('a'..'z'); my %heights = map { $letters[$_] => $heights[$_]} (0..25); chomp(my $str = <>); my @word = split //, $str; my $height = 0; my $width = 0; foreach my $l (@word) { if ($heights{$l} > $height) { $height = $heights{$l}; } $width++; } print $width * $height;