Amazon interview question

Find substring within words, efficiently.