This can be done according to its definition, and takes .
More clever versions can achieve .
This brings the total running time for FINITE-AUTOMATON-MATCHER to .
Actually, not too bad if pattern is small relative to the size of the text.