Problem M
Deterministic Finite Automata - Enumeration
Languages
en
is
You are given a deterministic finite automaton that accepts
the language
Input
The input contains the description of a deterministic finite automaton.
The first line contains four positive integers
Each state is an integer between
Finally, the input will contain an integer
Output
For each of the
Sample Input 1 | Sample Output 1 |
---|---|
5 2 1 2 ab 4 5 2 3 3 4 4 5 5 4 4 4 5 0 1 2 3 4 |
0 0 3 8 16 |
Sample Input 2 | Sample Output 2 |
---|---|
2 4 1 1 acgt 1 2 2 2 2 2 2 2 2 3 0 1 2 |
1 0 0 |