▁suffix ▁of ▁P ▁in ▁the ▁previous ▁match ▁attempt . ▁▁▁▁ ▁Specifically , ▁if ▁the ▁mismatch ▁took ▁place ▁at ▁position ▁i - 1 ▁in ▁P , ▁the ▁shift ▁magnitude ▁is ▁given ▁▁▁▁ ▁by ▁the ▁equation ▁len ( P ) ▁- ▁L [ i ]. ▁In ▁the ▁case ▁that ▁L [ i ] ▁= ▁- 1 , ▁the ▁full ▁shift ▁table ▁is ▁used . ▁▁▁▁ ▁Since ▁only ▁proper ▁suffix es ▁matter , ▁L [ 0 ] ▁= ▁- 1 . ▁▁▁▁ ▁""" ▁▁▁▁ ▁L ▁= ▁[- 1 ▁for ▁c ▁in ▁S ] ▁▁▁▁ ▁N ▁= ▁fundamental _ pre process ( S [ :: - 1 ]) ▁ ▁# ▁S [ :: - 1 ] ▁revers es ▁S ▁▁▁▁ ▁N . reverse () ▁▁▁▁ ▁for ▁j ▁in ▁range ( 0 , ▁len ( S )- 1 ): ▁▁▁▁▁▁▁▁ ▁i ▁= ▁len ( S ) ▁- ▁N [ j ] ▁▁▁▁▁▁▁▁ ▁if ▁i ▁!= ▁len ( S ): ▁▁▁▁▁▁▁▁▁▁▁▁ ▁L [ i ] ▁= ▁j ▁▁▁▁ ▁return ▁L ▁ ▁def ▁full _ shift _ table ( S : ▁str ) ▁-> ▁List [ int ]: ▁▁▁▁ ▁""" ▁▁▁▁ ▁Gener ates ▁F ▁for ▁S , ▁an ▁array ▁used ▁in ▁a ▁special ▁case ▁of ▁the ▁good ▁suffix ▁rule ▁in ▁the ▁Bo yer - Mo ore ▁▁▁▁ ▁string ▁search ▁algorithm . ▁F [ i ] ▁is ▁the ▁length ▁of ▁the ▁longest ▁suffix ▁of ▁S [ i :] ▁that ▁is ▁also ▁a ▁▁▁▁ ▁prefix ▁of ▁S . ▁In ▁the ▁cases ▁it ▁is ▁used , ▁the ▁shift ▁magnitude ▁of ▁the ▁pattern ▁P