Facebook Hacker Cup 2013:Beautiful Strings solution in PHP

Here is the solution for FHC 2013 Beautiful Strings problem in PHP: $ip = fopen(‘input.txt‘, “r”); $test_cases = trim(fgets($ip));     $c=1;     while($c!= $test_cases+1){         $case=preg_replace(‘/[^a-z]+/’, ”, strtolower(trim(fgets($ip))));         $vals=array_count_values(str_split($case));         arsort($vals);         $beauty=26;         $max_b=0;         foreach($vals as $v){             $max_b +=$v*$beauty;             $beauty–;

[READ MORE]