Source: https://www.ling.upenn.edu/courses/Spring_2002/ling106/dfa.pdf