Forward References – HackerRank Solution

In this post, we will solve Forward References HackerRank Solution. This problem (Forward References) is a part of HackerRank Regex series.

Solution – Forward References – HackerRank Solution


$Regex_Pattern = '/^(\2tic|(tac))+$/'; //Do not delete '/'. Replace __________ with your regex. 

$handle = fopen ("php://stdin","r");
$Test_String = fgets($handle);
if(preg_match($Regex_Pattern, $Test_String, $output_array)){
    print ("true");
} else {
    print ("false");


Note: This problem (Forward References) is generated by HackerRank but the solution is provided by CodingBroz. This tutorial is only for Educational and Learning purpose.

Leave a Comment

Your email address will not be published. Required fields are marked *