Created
January 30, 2013 13:37
-
-
Save touzoku/4673357 to your computer and use it in GitHub Desktop.
Beautiful strings problem solution. Didn't pass for some reason. https://www.facebook.com/hackercup/problems.php?pid=475986555798659&round=185564241586420
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use 5.10.00; | |
<>; | |
my $case; | |
for(<>){ | |
$case++; | |
chomp; | |
my(%c,$answer); | |
my $w = 26; | |
/[a-z]/i&&$c{lc()}++ for split; | |
$answer+=$w--*$_ for sort{$b<=>$a}values%c; | |
say "Case #$case: $answer"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment