<?php
function nthstrpos($haystack, $needle, $nth) {
$count = 0;
$pos = -1;
do {
$pos = strpos($haystack, $needle, $pos + 1); $count++;
} while ($pos !== false && $count < $nth);
return $pos;
}
// your code goes here
PD9waHAKCmZ1bmN0aW9uIG50aHN0cnBvcygkaGF5c3RhY2ssICRuZWVkbGUsICRudGgpIHsKCSRjb3VudCA9IDA7CgkkcG9zID0gLTE7CglkbyB7CgkJJHBvcyA9IHN0cnBvcygkaGF5c3RhY2ssICRuZWVkbGUsICRwb3MgKyAxKTsKCQkkY291bnQrKzsKCX0gd2hpbGUgKCRwb3MgIT09IGZhbHNlICYmICRjb3VudCA8ICRudGgpOwoJcmV0dXJuICRwb3M7Cn0KCi8vIHlvdXIgY29kZSBnb2VzIGhlcmUKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnYScsIDEpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnYScsIDIpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnYScsIDMpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnYScsIDQpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnbicsIDEpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnbicsIDIpKTsKdmFyX2R1bXAobnRoc3RycG9zKCdiYW5hbmEnLCAnbicsIDMpKTsK