Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下语言及其正则表达式
{w ∈ {a, b}* : w 以 bab 为前缀,以 babaa 为后缀}
回答:
正则表达式 = bab(a ∪ b)*babaa ∪ babaa ∪ bababaa
为什么需要加粗部分?
bab 是 babaa 的前缀,而 babaa 显然是它自己的后缀。因此,babaa 是一个可能的字符串。
babaa 是 bababaa 的后缀,bab 是 bababaa 的前缀。因此,它也应该包括在内。