Skip to content

Instantly share code, notes, and snippets.

@touzoku
Created January 30, 2013 13:37
Show Gist options
  • Save touzoku/4673357 to your computer and use it in GitHub Desktop.
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
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