Problem A
Deterministic Finite Automata - Read
You are given a deterministic finite automaton and a list of strings. For each string given, you should determine whether the automaton accepts or rejects the string.
Input
The first line of input contains four positive integers
Each state is an integer between
After that a line with the integer
Output
For each string to check, output a line containing either accept or reject, depending on whether the string was accepted or rejected.
Sample Input 1 | Sample Output 1 |
---|---|
3 2 1 1 ab 1 1 2 1 3 3 3 6 a aa ab abba aabaababa |
accept accept accept reject reject accept |
Sample Input 2 | Sample Output 2 |
---|---|
1 4 1 0 acgt 1 1 1 1 3 agaga gattaca |
reject reject reject |