text: Shift the pattern so that the next character in text aligns with the last occurrence of it in pattern . The condition s + m < n is necessary for the case when pattern occurs at the end of text
code: s += ( s + m < n ) ? m - badchar [ txt [ s + m ] ] : 1 ; } else