Problem D
Deterministic Finite Automata - Intersection
You are given two deterministic finite automata that accept
the languages
Input
The input contains the description of two deterministic finite automata that use the same alphabet. Each is described as follows.
The first line contains four positive integers
Each state is an integer between
Let the number of states in the two automata be
Output
Output any deterministic finite automaton representing the
intersection of the input automata. Your output is subject to
the same format and restrictions as the input, except it may be
larger, allowing
Sample Input 1 | Sample Output 1 |
---|---|
3 2 1 1 ab 1 1 2 1 3 3 3 4 2 1 1 ab 3 2 4 4 3 3 3 4 4 |
5 2 5 1 ab 2 1 1 2 3 2 1 1 3 4 1 |
Sample Input 2 | Sample Output 2 |
---|---|
1 4 1 0 acgt 1 1 1 1 1 4 1 1 acgt 1 1 1 1 1 |
1 4 1 0 acgt 1 1 1 1 |