fork download
  1. <?php
  2.  
  3. $bacon=array('a'=>'AAAAA', 'b'=>'AAAAB', 'c'=>'AAABA', 'd'=>'AAABB', 'e'=>'AABAA', 'f'=>'AABAB');
  4. $word="the jOs to kIll fAr";
  5.  
  6. $word=str_replace(" ","",$word);
  7. $word=wordwrap($word,5," ",true);
  8.  
  9. $word.=" B";
  10.  
  11. $word=preg_replace("![A-Z]!", "B", $word);
  12. $word=preg_replace("![a-z]!", "A", $word);
  13.  
  14. $word1=explode(" ",$word);
  15. $bacon=array_flip($bacon);
  16.  
  17. $baconWord="";
  18. for($i=0; $i<count($word1); $i++) {
  19. $baconWord.=$bacon[$word1[$i]];
  20. }
  21.  
  22. echo $baconWord;
  23. // your code goes here
Success #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
bbc
stderr
PHP Notice:  Undefined index: B in /home/ZIgTYw/prog.php on line 19