Вопрос

Set={a,b} and L7:"All words that begin with an a and end with a b" is given L7 can be defined by

a(a+b)*b

What is the meaning of "+" ? And, How to solve this problem ?

Это было полезно?

Решение

a       # first letter is always 'a'
(a+b)*  # zero or more sequence of letters 'a' or 'b' [one letter at time]
b       # last letter is always 'b'

Here + means or and then consequently, we have the below results:

ab
abb
abbb
aaab
abbbb
aaaab
abbbbb
aaaaab
.....
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top