Advertisement
Mihail_Atnsv

postOffice

Dec 15th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1. <?php
  2.  
  3. $input = explode("|", readline());
  4.  
  5. $first = $input[0];
  6. $second = $input[1];
  7. $third = $input[2];
  8.  
  9. $firstPattern = preg_match('/([#$%*&])(?<capital>[A-Z]+)(\1)/m', $first, $match);
  10. $capital = $match["capital"];
  11.  
  12. for ($i = 0; $i < strlen($capital); $i++) {
  13.     $currentChar = $capital[$i];
  14.     $currentAscii = ord($currentChar);
  15.  
  16.     $secondPattern = preg_match("/{$currentAscii}:(?<length>[0-9][0-9])/", $second, $match);
  17.     $length = $match["length"];
  18.  
  19.     $thirdPattern = preg_match("/(?<=\s|^){$currentChar}[^\s]{{$length}}(?=\s|$)/m", $third, $match);
  20.     echo $match[0] . PHP_EOL;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement