The solution submitted here is incorrect, as i think. I tried using the names as “joe john”, the answer must have been NO but YES is being displayed.
this is the corrected code…[LINK]!!!
the error was this…
if (countT == b.length()-1)
if (countT == b.length())
hope you understand the mistake…
@kunal361 >> yeah i got that. the guy that submitted it must be lucky. computer wasn’t able to detect this error in his code and marked it as solved.