A finite automaton begins in the start state, reads input symbols, making transitions based on these symbols. When the input sequence terminates, if it is in an accepting state, the automaton is said to accept that input string, otherwise the input is rejected.
Define a function called the final-state function, which
is the state that M is in after processing w.