Amazon Interview Question

Find substring within words, efficiently.