I need to create a NFA (or DFA, don't know which it is going to be yet) for this language:
L(A) = { w ∈ {a,b}* | count(w, a) = 2i, count(w, b) = 3j, i, j ∈ ℕ }
count(w, z) defines how often a letter z appears in the word w. In this case it's a multiple of 2 for 'a', and a multiple of 3 for 'b'.
Examples of a valid word: babab, aabbb, bbaab, bbbabbba
I struggled creating an automaton for that, so I thought I'd try creating a regular expression for it first to turn it to a NFA using this method, because I can easily test it on a regex test sites. But that too didn't work. I ended up with too many combinations that seemingly had no end.
I don't know how to create a regular expression for that without using some sort of counting mechanism. Can somebody give me a hint?