That means, the string has read ‘ab’ as substring if it reaches q2. String with count of ‘a’ divisible by 3 : The regular expression for strings with count of a divisible by 3 is {a 3n | n >= 0}. We can construct automata as shown in Figure 3. The above automata will accept all string of form a 3n.
For More Information Please Refer: