Implement the ranked automata evaluation to guarantee a O(|D|x|Q|)