Google help on software/programming And Windows Tricks: calculate the maximum length of palindrome by given any array of names or string

helponsoftware

Tuesday 28 April 2015

calculate the maximum length of palindrome by given any array of names or string

<?php
   function PalindromeLengthPuzzle($input1)
    {
$polin_array =array();
foreach ($input1 as $key => $value) {
  $res[]= substr($value,0,1);
}
print_r($res);
for($c=0;$c<=1000;$c++):
shuffle($res);

$result= implode('',$res);

if($result==strrev($result)){
 $polin_array[]=$result;   
}

endfor;
$polin_array=array_unique($polin_array);
print_r($polin_array);

foreach ($polin_array as $key => $value) {
    $val =strlen($value);
}
echo $val;
}

echo PalindromeLengthPuzzle(array('Bharti', 'Bharat','Brijesh','Bhavna','Anjit','Chand','Aushil'));
?>

No comments:

Post a Comment