我正在阅读
dragon book,并尝试解决如下的演习
原文链接:https://www.f2er.com/regex/357400.htmlWrite regular definitions for the following languages:
- All strings of digits with no repeated digits. Hint: Try this problem first with a few digits,such as { 0,1,2 }.@H_404_8@
尽管已经尝试解决了几个小时,我无法想象一个解决方案,除了非常冗长的话
d0 -> 0? d1 -> 1? d2 -> 2? d3 -> 3? d4 -> 4? d5 -> 5? d6 -> 6? d7 -> 7? d8 -> 8? d9 -> 9? d10 -> d0d1d2d3d4d5d6d7d8d9 | d0d1d2d3d4d5d6d7d9d8 | ...
因此不得不写10! d10中的替代品由于我们写这个常规定义,我怀疑这是一个正确的解决方案。你能帮我吗?