countP [ ] : Store count of all characters of pattern countTW [ ] : Store count of current window of text
let countP = new Array ( ALL_CHARS ) ; countP . fill ( 0 ) ; let countTW = new Array ( ALL_CHARS ) ; countTW . fill ( 0 ) ; for ( i = 0 ; i < M ; i ++ ) { countP [ pat [ i ] . charCodeAt ( ) ] ++ ; countTW [ txt [ i ] . charCodeAt ( ) ] ++ ; }