fork download
  1. <?php
  2. fscanf(STDIN, "%d", $Lwidth);
  3. fscanf(STDIN, "%d", $Lheight);
  4.  
  5. $alphabet = array();
  6.  
  7. $Text = stream_get_line(STDIN, 1024, "\n");
  8.  
  9. for ($h = 0; $h < $Lheight; ++$h)
  10. {
  11. $ltr = 'a';
  12. $ltr2 = 'A';
  13. while(true) //reading letters
  14. {
  15. $alphabet[$ltr] = stream_get_line(STDIN, $Lwidth);
  16. $alphabet[$ltr2] = $alphabet[$ltr];
  17. if ($ltr == 'z') break;
  18. ++$ltr;
  19. ++$ltr2;
  20. }
  21.  
  22. //reading '?'
  23. $alphabet['?'] = stream_get_line(STDIN, $Lwidth);
  24.  
  25. //reading endl
  26. fscanf(STDIN, "%c", $useless);
  27.  
  28. for ($i = 0; $i < strlen($Text); ++$i)
  29. {
  30. if //it is a letter
  31. (
  32. (('a' <= $Text[$i]) and ($Text[$i] <= 'z')) or
  33. (('A' <= $Text[$i]) and ($Text[$i] <= 'Z'))
  34. ) //then print it
  35. echo $alphabet[$Text[$i]];
  36. else //it is definitely something weird
  37. echo $alphabet['?'];
  38. }
  39. echo "\n";
  40. }
  41. ?>
Success #stdin #stdout 0s 82880KB
stdin
4
5 
E
 #  ##   ## ##  ### ###  ## # # ###  ## # # #   # # ###  #  ##   #  ##   ## ### # # # # # # # # # # ### ### 
# # # # #   # # #   #   #   # #  #    # # # #   ### # # # # # # # # # # #    #  # # # # # # # # # #   #   # 
### ##  #   # # ##  ##  # # ###  #    # ##  #   ### # # # # ##  # # ##   #   #  # # # # ###  #   #   #   ## 
# # # # #   # # #   #   # # # #  #  # # # # #   # # # # # # #    ## # #   #  #  # # # # ### # #  #  #       
# # ##   ## ##  ### #    ## # # ###  #  # # ### # # # #  #  #     # # # ##   #  ###  #  # # # #  #  ###  #  
stdout
### 
#   
##  
#   
###