kmp string search
refactored string search