Horspool's algorithm