Google interview question

The basic about finite state machine