Process txt over FA .
let i , state = 0 ; for ( i = 0 ; i < N ; i ++ ) { state = TF [ state ] [ txt [ i ] . charCodeAt ( 0 ) ] ; if ( state == M ) document . write ( " " + " " + ( i - M + 1 ) + " " ) ; } }