Corrected Horspool's algorithm to now work correctly (JS version)