Regular Expressions - Over the alphabet $(a, b, c)$

1k Views Asked by At

Express the language of all words whose first letter, if it exists, is the same as its last letter over the alphabet $(a, b, c)$.

This is what I have so far: $(a(a|b|c)^*a|b(a|b|c)^*b|c(a|b|c)^*c)^*|\epsilon$

I am not sure if this is right.

1

There are 1 best solutions below

0
On BEST ANSWER

Hint -- Start over, but take it step by step. Here's a suggested sequence. How would you express the language of words that begin and end with "a" and have nothing but c's in between, in fact, zero or more c's. If you get that, generalize to starting and ending with "a" or starting and ending with "b". Then generalize the stuff in between, the arbitrary number of c's, to satisfy the original problem. At that point, you will be almost home and can probably figure out the final steps for yourself.