title: Construct DFA for L = {(na(w)-nb(w)) mod 3>0}
body: <p>As per the title:</p>
  
  <p>L = {(n<sub>a</sub>(w)-n<sub>b</sub>(w)) mod 3>0}</p>
  
  <p>Alphabet = {a,b}</p>
  
  <p>I found two answers to this problem:</p>
  
  <p><a href="https://i.stack.imgur.com/s4qd4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s4qd4.png" alt="enter image description here"></a></p>
  
  <p>In this solution, our language is accepted.</p>
  
  <p>However,</p>
  
  <pre><code>w = b
  </code></pre>
  
  <p>is accepted as well.</p>
  
  <p>In the next solution:</p>
  
  <p><a href="https://i.stack.imgur.com/0V0UR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0V0UR.png" alt="enter image description here"></a></p>
  
  <p>Our problem of </p>
  
  <pre><code>w = b
  </code></pre>
  
  <p>is solved here but</p>
  
  <pre><code>w = aaab
  </code></pre>
  
  <p>is not accepted. </p>
  
  <p>How do I approach this problem? I couldn't find a suitable answer for it on the internet. </p>