Unique DFA struct with trie inside to simplify the code. Updated test cases.