countP [ ] : Store count of all characters of pattern countTW [ ] : Store count of current window of text
countP = [ 0 ] * ALL_CHARS NEW_LINE countTW = [ 0 ] * ALL_CHARS NEW_LINE for i in range ( M ) : NEW_LINE INDENT countP [ ord ( pat [ i ] ) ] += 1 NEW_LINE countTW [ ord ( txt [ i ] ) ] += 1 NEW_LINE DEDENT