Substring Searching Hackerrank Solution