Problem J
Deterministic Finite Automata - Is a Finite Language?
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
Output
Output finite if
Sample Input 1 | Sample Output 1 |
---|---|
4 2 2 2 ab 2 4 2 3 3 2 3 3 1 2 |
infinite |
Sample Input 2 | Sample Output 2 |
---|---|
4 4 1 2 acgt 1 2 2 2 2 2 3 3 3 3 4 4 3 4 3 3 3 4 |
finite |