And here is my line of reasoning when I first came upon it:
- This one seems difficult
- Finding a regular expression for it seems tricky, so i cannot follow this path to convert the regular expression to a DFA
- So I decided to solve the first part of the problem: Accept a string whose number of 'a' is a multiple of 3. This is quite easy, you just need 3 states: 1,2,3 with 1 as the start state, if there is an input 'a', you go to the next one, if it's 'b' you stay at that state, and the start state is also the finishing state. But here in this exercise, these 3 states would actually be 3 'big' states. Then the problem becomes designing the internals of these 'big states and how they interact.
I had no choice but to use guesswork in order to arrive at a solution. Here is what I came up with (1,2,3 are finishing states, 3 is the start state, and also 7 and 9 both goes to 1 if an input 'a' is received):
I also used DFA minimization on this one, and found out that it is already minimal. However, the textbooks gives another solution:

But I don't understand how it is correct! I just can't figure it out :(. And I don't even know if my solution is 100% correct. Please help me, thank you very much :)
