text: Shift the pattern so that the bad character in text aligns with the last occurrence of it in pattern . The max function is used to make sure that we get a positive shift . We may get a negative shift if the last occurrence of bad character in pattern is on the right side of the current character .
code: s += max ( 1 , j - badchar [ txt [ s + j ] ] ) ; } }