This is 2nd Part of Regular expression in theory of computation solved examples. You can also read Regular expression in theory of computation solved examples Part – 1.

## 1. Construct the regular expression for all strings in which all runs of a’s has lengths that are multiple of three, over input alphabets ∑ = {a, b, c}.

**Solution:**

We have the input alphabets ∑ = {a, b, c}.

Here, the resultant regular expression will denote the set of all string in which all runs of a’s has length that are multiple of three, i.e., the length of a’s in the string varies as 3 × 0 = 0, 3 × 1 = 3, 3 × 2 = 6, 3 × 3 = 9, 3 × 4 = 12,…. and soon.

To fix this problem, we first write the regular expression which represents the set of all strings over the given ∑. It is-

(a + b + c)*

But, the given problem requires the length of ‘a’ which is multiple of three.

Thus, the regular expression which fulfill this requirement of the given problem can be written as-

(aaa, + b + c)*

It can only handle consecutive a’s! If we have a string like

aabcbca or abcaba

it can not handle them!