#NEWLINE# def _ends( self , s ) : #NEWLINE# #INDENT# 'True <=> 0,...k ends with the string s.' #NEWLINE# if ( s [ ( - 1 ) ] != self . b [ self . k ] ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# length = len ( s ) #NEWLINE# if ( length > ( self . k + 1 ) ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# if ( self . b [ ( ( self . k - length ) + 1 ) : ( self . k + 1 ) ] != s ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# self . j = ( self . k - length ) #NEWLINE# return 1