I need a little help with Regular Expressions.
The allowed operations are obviously + (union) , * (Kleene star) and concatenation.
I have to write Regex for the following 2 examples. I have tried a lot, but havn't succeed:
Write a Regex that receives all the words above $\Sigma = \{s,t\}$ which include at least two instances of the letter
t, and don't include the subwordstt.Write a Regex that receives all the words above $\Sigma = \{s,t\}$ which include the subword
stts, and don't include the subwordtss.
I thought about these 2 alot. I understood that in 1 I have to somehow make sure that each 2 t's are seperated by s (except some exceptions). the same trick should be implemented in 2 too.
Thanks ;)
For 1, one must be carefiul to include variants starting with at least two $t$:
ttt*(s+st)*Then there are the variants starting with one $t$:tss*t(s+st)*And those starting with no $t$:ss*tss*t(s+st)*. These can be nicely combined into(tt*+s*tss*)t(s+st)*, a pattern one might not have guessed out of the blue.