3 approaches to the DFA - added the working one after pairing with Will