fork(2) download
  1. <?php
  2.  
  3. $stdin = tmpfile();
  4. fwrite($stdin, "2\r\nAaBbCc\r\nXxYyZz\r\n");
  5. fseek($stdin, 0);
  6. while(true) {
  7. $t = fread($stdin,3);
  8. $t = trim($t);
  9. $t = (int)$t;
  10. while($t--) {
  11. $sLen=0;
  12. $subStringsNum=0;
  13. $searchString="";
  14. $searchString = fread($stdin,20);
  15. $sLen=strlen($searchString);
  16. $sLen=strlen(trim($searchString));
  17. for($i=0;$i<$sLen;$i++) {
  18. for($j=$i;$j<$sLen;$j++) {
  19. if(preg_match("/^[A-C]+$/i",substr($searchString,$i,$sLen-$j))) {$subStringsNum++;}
  20. }
  21. }
  22. echo $subStringsNum."\n";
  23.  
  24. }
  25. die;
  26. }
  27. ?>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
21
0