我正在努力解決以下問題。我應該使用抽象引理或常規語言閉包,但我不能爲這兩個問題提出解決方案。任何洞察力將非常感謝它。謝謝。 對於以下每種語言證明它是定期或證明它是不正規: 1) {a^m b^n c^k: m>n>k}
2) {u that belong to {0,1}^* : u begins with 1001 and does not end with 0010}
我當它涉及到數字
import re
text = 'fruits to be sold are apple orange and peach'
x = re.findall(r'fruits.*(apple|orange|peach).*',text,re.I)
print(x)
該代碼的目標是返回一個列表,其中包含單詞'fruits'後面的句子中的水果名稱。 所以預期的結