Problem: given a set of regular grammar, answer the state of the input string in the corresponding FSA (Finite-State Automata). In problem 620, reporting the input is not in the grammar is also required.
Solution: because the spec gives only a couple of simple rules, we can solve it by checking the head and the tail of the given string iteratedly.
No comments:
Post a Comment