End position is checked using the string length value . q0 is the starting state . q1 and q2 are intermediate states . q3 and q4 are final states .
function q1 ( s , i ) { document . write ( " " ) ; if ( i === s . length ) { document . write ( " " ) ; return ; }