Scratch code for substring search