Solution to the string searching problem.