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 .
void q1 ( string s , int i ) { cout << " q1 - > " ; if ( i == s . length ( ) ) { cout << " NO ▁ STRNEWLINE " ; return ; }