I need to figure out the answer to this question;

"Describe an algorithm that takes as input an automaton M = (Q,S, t, s,A),

where S = {a,b, c}, and determines whether or not M accepts a word a which does not

contain c (i.e. whether or not L(M) contains a word in {a,b}∗). You do not have to give

a formal proof that your algorithm is correct but you should indicate why this is the case."

This is what i ahve come up with so far, would you say this is correct?

Let M = (Q, S, t, s, A) be a finite deterministic automaton, where Q is

state set, S = a, b, c is alphabet, t : (Q x S) x Q) is transitions function,

s 'elem' Q is initial state, and A 'sub' Q is the set of nite state. To determine,

whether the word w 'elem' S* is accepted by M, do the following steps.

(a) If w = e (empty word), then w is accepted by M if and only if

t 'elem' A (initial state is also nite), process stops. Otherwise, go to

the next step.

(b) Let w0 = w, q0 = s, k = 0.

(c) If wk = e (empty word), then w is accepted by M if and only if

qk 'elem' A, process stops. Otherwise go to the next step.

(d) Let wk = xwk+1, where x 'elem' S (x is the first symbol of wk). Let

qk+1 = t(qk, x). Word w is accepted by M if and only if word wk+1

is accepted by automaton < Q, S, qk+1,wk+1 >.

(e) Increase k by 1, and go step c.

Each step reduces the length of current word (|wk+1| = |wk| - 1), so

this process is nite.