Finite-State Automaton

I learnt Finite-State Automaton many years ago. This problem is a good chance for me to make one myself. Maybe there are many other ways to solve this problem since it is a simple regex matching. However, this problem helps me understand Finite-State Automaton better.

Code shoud do as following

  1. Build a NFA using pattern
  2. Convert to DFA
  3. Let string walk in the DFA to see if it matches the pattern